1
0
mirror of https://github.com/projectatomic/atomic.git synced 2026-02-06 03:45:28 +01:00

1111 Commits

Author SHA1 Message Date
Giuseppe Scrivano
b507039153 atomic: honor UNINSTALL after stop of a container
Honor the UNINSTALL label after the specified container was stopped.

Introduced by: 18959843d5

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1576285

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1242
Approved by: rhatdan
2018-06-28 07:48:53 +00:00
Giuseppe Scrivano
4cf54d1e7a syscontainers: use XDG_DATA_HOME instead of XDG_DATA_DIR
Adapt to the change of location in podman and buildah.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1243
Approved by: rhatdan
2018-06-28 07:48:44 +00:00
Giuseppe Scrivano
5a342e32cd docker: restore uninstall when no container name is specified
write_install does not write twice the same container id/name.

Closes: https://github.com/projectatomic/atomic/issues/1217

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1219
Approved by: rhatdan
2018-06-11 18:50:58 +00:00
Giuseppe Scrivano
f37679eb93 syscontainers: honor XDG_DATA_DIR when specified
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1240
Approved by: rhatdan
2018-06-09 11:31:54 +00:00
Giuseppe Scrivano
f6617611ca util: if the Skopeo error is empty, print the full stderr
Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1583731

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-06-07 23:32:57 +02:00
Giuseppe Scrivano
18959843d5 atomic: uninstall checks for container existance before rm'ng it
a container might be deleted by the stop label, if it was started with
--rm.  Check for its presence before attempting to delete it.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1576285

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1235
Approved by: rhatdan
2018-05-10 16:46:30 +00:00
Giuseppe Scrivano
e045e8baef syscontainers: --user uses runc by default
bwrap-oci can still be used with the --runtime option.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1226
Approved by: rhatdan
2018-04-26 15:55:43 +00:00
Giuseppe Scrivano
31f47af1f7 syscontainers: configure the user namespace for the user case
bwrap-oci was filling this information for us, but if we want to use
runc we need to ensure the "user" namespace is always present and that
valid uid/gid mappings exist in the OCI configuration file.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1226
Approved by: rhatdan
2018-04-26 15:55:43 +00:00
Giuseppe Scrivano
32084fe7f4 syscontainers: use --rootless for the default user spec file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1226
Approved by: rhatdan
2018-04-26 15:55:43 +00:00
Giuseppe Scrivano
1544f0d208 syscontainers: do not use systemd cgroups for the user case
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1226
Approved by: rhatdan
2018-04-26 15:55:43 +00:00
Giuseppe Scrivano
60fe095ca5 overlay: reintroduce error when using 'rw'
the error message was mistakenly dropped with commit:

7179eab364

Closes: https://github.com/projectatomic/atomic/issues/1222

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1223
Approved by: rhatdan
2018-04-19 10:04:10 +00:00
Giuseppe Scrivano
ee63a4be01 docker: propagate args from uninstall to stop
so that it is possible to uninstall a running container:

Closes: https://github.com/projectatomic/atomic/issues/1221

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1229
Approved by: rhatdan
2018-04-16 17:53:26 +00:00
Giuseppe Scrivano
b5c4a37ff6 util: correctly set the error from Skopeo
$ atomic install --system --system-package=no registry.fedoraproject.org/f28/etcd
Error reading manifest latest in registry.fedoraproject.org/f28/etcd: manifest unknown: manifest unknown

Closes: https://github.com/projectatomic/atomic/issues/1224

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1228
Approved by: rhatdan
2018-04-16 16:39:45 +00:00
Micah Abbott
2fd08606a9 containers: fix feedback when deleting containers
The feedback when deleting containers was asking the user if they
wanted to delete images, instead of containers.  This updates the
feedback to use the correct terminology.

Closes: #1218
Approved by: rhatdan
2018-03-30 13:20:12 +00:00
Giuseppe Scrivano
6820f8f3b5 install: avoid several races with file lock
we should never release the lock until the entire read+write operation
is completed as the data might have changed between the read and the
write.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1214
Approved by: baude
2018-03-27 13:06:11 +00:00
Giuseppe Scrivano
ba23e76924 install: support multiple containers per image
Change the install data format to keep a list of containers for each
image installed, so that multiple containers for the same image can be
installed and uninstalled.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1559935

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1214
Approved by: baude
2018-03-27 13:06:11 +00:00
Dirk Boye
119f1236bb Do not call any selinux methods if selinux is disabled
Closes: #1213
Approved by: giuseppe
2018-03-27 12:26:54 +00:00
Giuseppe Scrivano
56c32aeca3 install: hide warning if --system or --user is used
when --system or --user are used, hide the warning:

  Note: Switching from the 'docker' backend to the 'ostree' backend based
  on the 'atomic.type' label in the image.  You can use --storage to
  override this behaviour.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1216
Approved by: TomSweeneyRedHat
2018-03-26 13:19:54 +00:00
Steve Milner
490ba97c80 syscontainers: Add more docstrings
Signed-off-by: Steve Milner <smilner@redhat.com>

Closes: #1210
Approved by: giuseppe
2018-03-14 17:22:46 +00:00
Eldar Yusupov
21c11ebdc6 syscontainers: use util.Decompose in _parse_imagename
It also fixes an issue with incorrectly parsing postgres:9.6
as (postgres:9.6, postgres, 9:6).

Closes: #1206
Approved by: giuseppe
2018-03-13 10:44:22 +00:00
Micah Abbott
a8bace279c containers: add metavar for rebase option
The inline help for `atomic containers update` currently shows
`--rebase=REBASE` which is not very helpful in terms of what kind of
argument is supposed to be passed to that flag.

This change just adds a `metavar` to show that users should pass in an
image name to the `--rebase` flag.

Closes: #1204
Approved by: giuseppe
2018-03-09 06:24:49 +00:00
Ruixin Bao
634368ad94 syscontainer: add skopeo copy for docker-daemon
Before, we save a docker image to a tar and use docker-archive to
perform copying image to ostree. Now, we can do that easily using
`skopeo copy docker-daemon:image:latest ostree:image@/ostree/repo`.
Therefore, changing the code to utilize that.

And since now, we are considered fully migrated to using skopeo only
path, let's also refactor the skopeo checking a bit to a higher level
logic to avoid duplication

Closes: #1180
Approved by: giuseppe
2018-03-02 15:21:32 +00:00
Ruixin Bao
e97d3f7935 syscontainer: remove unused functions
Based on earlier commits, the old importing layers to ostree
will become no longer useful after the introduction of new
copying docker images using skopeo.

Therefore, those two functions will get removed

Closes: #1180
Approved by: giuseppe
2018-03-02 15:21:32 +00:00
Ruixin Bao
9e12c96105 syscontainer: replace docker to ostree copy method
Originally, we only support copying images from docker to ostree using
ostree layering copy way. But that method is a lot slower in comparison to
skopeo copy. Since nowadays skopeo already start support copying
from docker-archive to ostree, let's replace that here in order to be consistent
with the previous commit. (I.e: only support skopeo and no ostree fallback)

Also, to keep the image name from docker tar to be consistent, part of
the old functionality of extracting the tarfile was reused. The name
was read from the information inside the docker tar. Therefore, the
image name is independent from the tar file name, making the name
consistent

Lastly, the logic for using skopeo copy to ostree was refactored so
it can be reused for future skopeo copying operations

Closes: #1180
Approved by: giuseppe
2018-03-02 15:21:32 +00:00
Ruixin Bao
de5b1d527c syscontainer: remove of fallback version of skopeo
Based on discussion, skopeo is assumed to include support for
ostree copy from now on.

The users will now be noted to upgrade skopeo to newest version
if their skopeo version does not support copy to ostree.

For now, looks like user will be able to use skopeo copy with ostree
after version 0.1.20, so skopeo v0.1.21 should contain the feature
1d5c681f0f

Closes: #1180
Approved by: giuseppe
2018-03-02 15:21:32 +00:00
Ruixin Bao
6a3bb3fb46 syscontainer: let uninstall fail when name specified
Based on discussion https://github.com/projectatomic/atomic/issues/1199#issuecomment-369153184,
we want to disallow user to specify --name option for uninstalling system containers.

Instead, we should encourage user to delete container using atomic
containers delete or atomic uninstall NAME.

Closes: https://github.com/projectatomic/atomic/issues/1199

Closes: #1202
Approved by: giuseppe
2018-03-02 08:45:26 +00:00
Giuseppe Scrivano
83fce8f33a images: add cache for dangling images
do not reload the list of all the images every time we check if an image
is dangling.  This makes "images list" extremely slow when used on the
Docker backend.

On my system (with ~100 images), this patch brings down the wall clock
from ~10 seconds to ~0.5 seconds:

$ /usr/bin/time -v ./atomic images list -a 2>&1 | grep "wall clock"
	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:09.84

to:

$ /usr/bin/time -v ./atomic images list -a 2>&1 | grep "wall clock"
	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.58

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1200
Approved by: rhatdan
2018-02-28 14:42:34 +00:00
Giuseppe Scrivano
ca5d43a5fe syscontainers: rebase pulls the image when missing
atomic containers update --rebase=$TO $CONTAINER attempts to pull the
image if it is missing in the repository.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1198
Approved by: rhatdan
2018-02-27 11:33:31 +00:00
Giuseppe Scrivano
873f0b6aaf syscontainers: drop pull from a remote ostree
this code was added for pulling directly from an OSTree repository.  It
wasn't never really used and it expects the image to be fully exploded
in an ostree commit without supporting OCI layers.

Dropping this part also avoid confusion with what we do with Skopeo
where "ostree:" is supported both as source and destination.

Closes: https://github.com/projectatomic/atomic/issues/1193

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1197
Approved by: rhatdan
2018-02-26 13:57:52 +00:00
Giuseppe Scrivano
df2c209c27 run: add option --runtime
it allows to select a different OCI runtime to use with atomic run.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1196
Approved by: rhatdan
2018-02-23 15:15:05 +00:00
baude
a0dcf85d15 1.22
Signed-off-by: baude <bbaude@redhat.com>
2018-02-21 08:12:31 -06:00
Ruixin Bao
aae6249aa5 syscontainer: refactor container service part in do_checkout
Refactor pieces related to handling container service in
do_checkout function. Again, no functionality should be impacted.

Closes: #1188
Approved by: giuseppe
2018-02-20 16:06:50 +00:00
Ruixin Bao
c8dbbd866f syscontainer: remove unused logic
In 'do_checkout' function, we tend to make symlink when prefix is not
specified. However, that has been done twice, if prefix is not specified.
Thus remove the unused logic

Closes: #1188
Approved by: giuseppe
2018-02-20 16:06:50 +00:00
Ruixin Bao
5e9ed74858 syscontainer: small refactor for getting exports
Refactor the part that we get the exports path. No
functionality change should happen

Closes: #1188
Approved by: giuseppe
2018-02-20 16:06:50 +00:00
Giuseppe Scrivano
6ce83c45e5 syscontainers: raise an error when run --name= is used
It is not supported by the OSTree storage.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1186
Approved by: baude
2018-02-19 16:03:47 +00:00
Giuseppe Scrivano
71c258af4f syscontainers, run: automatically pull the image if missing
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1186
Approved by: baude
2018-02-19 16:03:47 +00:00
Giuseppe Scrivano
0f2716bcdd syscontainers: quiet tmpfiles.d in interactive mode
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1186
Approved by: baude
2018-02-19 16:03:47 +00:00
Giuseppe Scrivano
3161e59011 syscontainers: implement "atomic run IMAGE"
if we try "atomic run IMAGE" then the command creates a "oneshot"
container, modifies the args for the config.json file and it runs the
specified command.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1186
Approved by: baude
2018-02-19 16:03:47 +00:00
Giuseppe Scrivano
6eebb86402 atomic, run: implement --set option
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1186
Approved by: baude
2018-02-19 16:03:47 +00:00
Giuseppe Scrivano
20670d713d syscontainers: refactor config.json rewrite to a new function
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1186
Approved by: baude
2018-02-19 16:03:47 +00:00
Giuseppe Scrivano
df49f70100 backendutils: fix crash when Docker is not running
_get_backend_index_from_string returned a wrong index as it considers
all the backends supported, not the current ones available.

Take rid of the function and lookup directly into the available backends
list.

Fix this exception:

Namespace(_class=<class 'Atomic.uninstall.Uninstall'>, args=[], assumeyes=False, debug=True, display=False, force=False, func='uninstall', ignore=False, image='etcd', name=None, opt1=None, opt2=None, opt3=None, profile=False, storage='ostree')
list assignment index out of range
Traceback (most recent call last):
  File "./atomic", line 185, in <module>
    sys.exit(_func())
  File "atomic/Atomic/uninstall.py", line 54, in uninstall
    be, img_obj = beu.get_backend_and_image_obj(self.args.image, str_preferred_backend=self.args.storage)
  File "atomic/Atomic/backendutils.py", line 88, in get_backend_and_image_obj
    del backends[self._get_backend_index_from_string(str_preferred_backend)]
IndexError: list assignment index out of range

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1182
Approved by: ashcrow
2018-02-17 09:22:56 +00:00
Giuseppe Scrivano
279d4d4bb3 syscontainers: correctly setup the rootfs SELinux label
The files inside the container are labelled by Skopeo when the image is
pulled to the OSTree storage.

Instead the root directory is created by atomic and by default it gets
the label "unconfined_u:object_r:container_share_t:s0".

Make sure we label the rootfs with the same label of '/'.

We have changed the way files are labelled by Skopeo but we forgot to
change the label for the rootfs created by atomic.  This patch ensures
the SELinux label for the rootfs is set.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1544175

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1185
Approved by: cgwalters
2018-02-15 08:36:09 +00:00
Ruixin Bao
dba3265e79 syscontainer: fix for missing images display in ostree backend
This fixes https://github.com/projectatomic/atomic/issues/1179.

Before, we assumed the image ref with 64 characters is default to
image layers(images with repository <none>), but as issue 1179
pointed out, there are some exceptions.

We now migrated to check if the ref is hex. If the ref is hex, we
can conclude it should be images with repository <none>

Closes: #1181
Approved by: giuseppe
2018-02-14 17:49:37 +00:00
baude
c64d77f883 Add copr builds
When a PR is merged, COPR will build a new atomic rpm
here:

https://copr.fedorainfracloud.org/coprs/baude/Upstream_CRIO_Family/

Signed-off-by: baude <bbaude@redhat.com>

Closes: #1187
Approved by: giuseppe
2018-02-13 15:55:33 +00:00
Giuseppe Scrivano
1d9df1cc1c rpm: install from local cache only
do not update the cache when installing a local rpm.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1183
Approved by: TomasTomecek
2018-02-12 19:59:18 +00:00
Giuseppe Scrivano
8c7648283c rpmwriter: specify RPMTAG_SOURCERPM
latest dnf failed the installation with:

"Error: Will not install a source rpm package"

Specify an empty source rpm tag so that the rpm is not considered a
source rpm.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1183
Approved by: TomasTomecek
2018-02-12 19:59:18 +00:00
Giuseppe Scrivano
ffadf3a5e7 rpm_host_install: fix TypeError with SELinux bindings
It solves a TypeError exception:

Traceback (most recent call last):
  File "/bin/atomic", line 185, in <module>
    sys.exit(_func())
  File "/usr/lib/python2.7/site-packages/Atomic/install.py", line 134, in install
    return be.install(self.image, self.name)
  File "/usr/lib/python2.7/site-packages/Atomic/backends/_ostree.py", line 128, in install
    return self.syscontainers.install(image, name)
  File "/usr/lib/python2.7/site-packages/Atomic/syscontainers.py", line 563, in install
    return_value = self._install(image, name)
  File "/usr/lib/python2.7/site-packages/Atomic/syscontainers.py", line 686, in _install
    self._checkout_wrapper(repo, name, image, 0, SystemContainers.CHECKOUT_MODE_INSTALL, values=values, remote=self.args.remote, system_package=self.args.system_package)
  File "/usr/lib/python2.7/site-packages/Atomic/syscontainers.py", line 797, in _checkout_wrapper
    return self._checkout(repo, options)
  File "/usr/lib/python2.7/site-packages/Atomic/syscontainers.py", line 813, in _checkout
    return self._do_checkout(repo, options)
  File "/usr/lib/python2.7/site-packages/Atomic/syscontainers.py", line 1126, in _do_checkout
    rpm_install_content = self._handle_system_package_files(options, manifest, exports)
  File "/usr/lib/python2.7/site-packages/Atomic/syscontainers.py", line 469, in _handle_system_package_files
    new_installed_files_checksum = RPMHostInstall.rm_add_files_to_host(options["installed_files_checksum"], exports, options["prefix"] or "/", files_template=installed_files_template, values=options["values"], rename_files=rename_files, use_links=use_links)
  File "/usr/lib/python2.7/site-packages/Atomic/rpm_host_install.py", line 155, in rm_add_files_to_host
    created = RPMHostInstall._copyfile(selinux_hnd, src_file, dest_path, try_hardlink=try_hardlink)
  File "/usr/lib/python2.7/site-packages/Atomic/rpm_host_install.py", line 24, in _copyfile
    ctx = selinux.selabel_lookup_raw(selinux_hnd, dest, mode)
TypeError: in method 'selabel_lookup_raw', argument 3 of type 'char const *'

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1542144

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1175
Approved by: peterbaouoft
2018-02-05 20:16:54 +00:00
baude
3c0457427c Bump to V1.21.1
Signed-off-by: baude <bbaude@redhat.com>
2018-02-01 13:08:46 -06:00
Brent Baude
e983379253 Merge pull request #1170 from giuseppe/atomic-read-labels-fromv1Compatibility-block
syscontainers: read labels from v1Compatibility
2018-02-01 13:03:45 -06:00
Giuseppe Scrivano
ef871e7147 util: change RUNC and BWRAP_OCI env variable
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1171
Approved by: baude
2018-02-01 18:15:15 +00:00