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

1705 Commits

Author SHA1 Message Date
Brent Baude
d36c015e7e Merge pull request #1192 from baude/1.22
1.22
v1.22
2018-02-21 08:13:33 -06: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
594ce2a1ae unit: add test for encode_to_ostree_ref
Add a unit test to verify that it is not possible for
an image to be hex after encoding, and a tag "latest" will
be appended if the image does not have a valid tag.

Closes: #1181
Approved by: giuseppe
2018-02-14 17:49:37 +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
Tomas Tomecek
d69f76580b depend on version 2 of docker-py
which is now available as 'docker' in PyPI and as a `python{2,3}-docker`
in Fedora.

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>

Closes: #902
Approved by: rhatdan
2018-02-12 20:19:08 +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
Jonathan Lebon
6861975111 ci: use centos/7/atomic/smoketested
The `/alpha` image has been deprecated a while ago and now no longer
exists. Use the `/smoketested` image instead. For more information, see:

https://github.com/projectatomic/papr/blob/master/docs/DISTROS.md

Closes: #1184
Approved by: miabbott
2018-02-12 16:49:00 +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
Brent Baude
1170769006 Merge pull request #1172 from baude/1.21
Bump to V1.21.1
2018-02-01 13:09:46 -06: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
Giuseppe Scrivano
7378da5ac4 util: look for runc under /usr/bin
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1171
Approved by: baude
2018-02-01 18:15:15 +00:00
Giuseppe Scrivano
f4cacde67f docs: add missing dependencies on Debian
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1171
Approved by: baude
2018-02-01 18:15:15 +00:00
Giuseppe Scrivano
38a2e54bd6 util: do not expect Registries in Docker info
upstream Docker has no support for additional registries, if that is
the case hardcode to ['docker.io'].

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

Closes: #1171
Approved by: baude
2018-02-01 18:15:15 +00:00
Giuseppe Scrivano
79a8f90d34 install: --system-package is supported also by Docker
so it should not depend on ostree being present.

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

Closes: #1171
Approved by: baude
2018-02-01 18:15:15 +00:00
Giuseppe Scrivano
12edeebb0e syscontainers: read labels from v1Compatibility
Images coming from registry.access.redhat.com through "skopeo copy"
have this information in the "v1Compatibility" block.  Use this
information so we can correctly catch "atomic.run".

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-02-01 17:36:34 +01:00
Alex Jia
772b8c9dc7 Atomic.util: delete extra comma in the skopeo_delete()
Signed-off-by: Alex Jia <ajia@redhat.com>

Closes: #1168
Approved by: giuseppe
2018-02-01 13:26:04 +00:00
Alex Jia
9f87c4ad58 Atomic.run: fix help doc
Signed-off-by: Alex Jia <ajia@redhat.com>

Closes: #1169
Approved by: giuseppe
2018-02-01 13:08:35 +00:00
Giuseppe Scrivano
f1d36a2126 syscontainers: allow the container name to end in .[01]
We skipped file names just based on their ending without checking if
it is a symlink.  This prevented container with a name ending in .0 or
.1 to be uninstalled.

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

Closes: #1166
Approved by: peterbaouoft
2018-02-01 09:46:58 +00:00
Ruixin Bao
6e55cc8e6b unit: add unit test for rpm_host_install
A unit test for rm_add_files_to_host is added. The basic/expected
functionality of that function is tested by the new test

Other functions in rpm_host_install are mostly covered
by the integration test already, and thus not tested here

Closes: #1155
Approved by: giuseppe
2018-01-31 14:45:14 +00:00
Ruixin Bao
deb87057c5 unit: add unit test for refactored 'system_package' function
A 'high-level' unit test is added that covers basic functionality
check for refactored function '_handle_system_package_files'.

Closes: #1155
Approved by: giuseppe
2018-01-31 14:45:14 +00:00
Ruixin Bao
a707343a7a syscontainers: refactor syscontainer manifest dup
Since most of the local variables rooted from manifest are removed,
now it is safe to refactor the manifest duplication into a function.

There are two places that uses the similar style of reading manifest
and thus duplication is removed once the refactoring is done.

Closes: #1155
Approved by: giuseppe
2018-01-31 14:45:14 +00:00
Ruixin Bao
dfb54df58c syscontainer/unit: refactor writing info into a function
This commit refactors the writing info part from 'do_checkout'
into a function.

Also, because of the above action, two of the local variables
'installed_files_template' and 'rename_files' are also removed

Other than those, an extra error case was added to the except list.

A unit test is added for future regression

Closes: #1155
Approved by: giuseppe
2018-01-31 14:45:14 +00:00
Ruixin Bao
bfe1737897 syscontainer: refactor system_package related handle
Refactor the code section for handling system_package
into a function.

Another worthy point to note is that now the old local
variables from the previous code section is refactored into
a dictionary to reduce the number of local variables and coupling
among other parts in '_do_checkout'

Closes: #1155
Approved by: giuseppe
2018-01-31 14:45:14 +00:00
Ruixin Bao
c25101e7db syscontainers/unit: refactor rename files part
This commit refactors the "rename file value substitution" code
section in '_do_checkout' function

There should not be any functional impact with this commit

A unit test is added for future regression

Closes: #1155
Approved by: giuseppe
2018-01-31 14:45:14 +00:00
Ruixin Bao
676ad7cb5f syscontainer: refactor tmpfile cleanup and manifest
This commit contains small refactoring of getting manifest
attributes and refactoring of the "tempfile cleaning during
upgrade" code section in '_do_checkout'

Also, 'has_container_service' local variable is genereated in the
function instead of being passed in as a parameter. This is done
because in the future refactoring we might want to elminate the
usage of local variables related to manifest completly.

A unit test is added to verify getting manifest attribute works
as expected

Closes: #1155
Approved by: giuseppe
2018-01-31 14:45:14 +00:00
Giuseppe Scrivano
b800b1ee50 install: do not fail when ostree is not installed
Solves this exception:

'Namespace' object has no attribute 'system'
Traceback (most recent call last):
File "/usr/bin/atomic", line 185, in <module> sys.exit(_func())
File "/usr/local/lib/python2.7/dist-packages/Atomic/install.py", line
110, in install str_backend = 'ostree' if self.args.system else
self.args.storage or storage AttributeError: 'Namespace' object has no
attribute 'system'

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

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

Closes: #1167
Approved by: baude
2018-01-30 17:48:28 +00:00
Giuseppe Scrivano
5fcc8051db tests, syscontainers: add tests for useLinks
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1163
Approved by: peterbaouoft
2018-01-25 14:33:37 +00:00
Giuseppe Scrivano
b68436a19f syscontainers: allow way to override use-links
we use hard links now by default when copying files to /usr, allow a
way to override this behavior through the manifest file.

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

Closes: #1163
Approved by: peterbaouoft
2018-01-25 14:33:37 +00:00
Giuseppe Scrivano
6c122f5a8b rpm_host_install: use hard links for files copied under /usr
Assume files under /usr are not going to be overwritten so create an
hard link instead of copying these files from the container
/exports/hostfs checkout directory.

Depends on: https://github.com/containers/image/pull/401

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

Closes: #1163
Approved by: peterbaouoft
2018-01-25 14:33:37 +00:00
Giuseppe Scrivano
993edca4c6 rpm_host_install: _copyfile supports copy by hard links
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1163
Approved by: peterbaouoft
2018-01-25 14:33:37 +00:00
Ruixin Bao
c41a3c55b2 syscontainers: refactoring duplicated write config function
This commit contains refactoring for write config in '_do_checkout' function,
this refactoring also removes the duplication of writing config in 'run_once'

There should not be functional impact with this commit.

A unit test is added for future regression

Closes: #1160
Approved by: giuseppe
2018-01-17 09:21:09 +00:00
Ruixin Bao
5dda2f7c29 syscontainer: fix for previous refactoring
This is regression from https://github.com/projectatomic/atomic/pull/1164

The values local variable should instead be options["values"]

Closes: #1160
Approved by: giuseppe
2018-01-17 09:21:09 +00:00
Ruixin Bao
0b1222c4be syscontainer: remove unused function
This commit is regression from 0902503ea7

This unused function was removed, and no functional impact should be introduced

Closes: #1160
Approved by: giuseppe
2018-01-17 09:21:09 +00:00
Ruixin Bao
cd6822c1c9 syscontainer: refactor parameter list
According to discussion, the '_checkout' function is now being replaced
temporarily with '_checkout_wrapper'. Now, the parameters other than
repo is being packed into a dictionary and the parameter list for
'_do_checkout' and '_checkout' is greatly shortened

This commit also contains a small  "if fix", by refactoring the same
if statements into one.

This commit enables further refactoring on '_do_checkout' and should
not introduce any functional change. With the help with other future
refactoring that builds on top of this commit, '_do_checkout' function
should look nicer in the future =).

Closes: #1164
Approved by: giuseppe
2018-01-16 18:24:08 +00:00
Tomas Tomecek
c7a9f51ccc mount: re-raising hides real cause of an exc
which makes it impossible to figure out what went wrong

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>

Closes: #1156
Approved by: rhatdan
2018-01-10 19:12:47 +00:00