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

152 Commits

Author SHA1 Message Date
Brent Baude
1db4288aa9 Atomic/diff.py: Use go-mtree for file comparisons
The previous algorithm for comparing files used python's
dircmp and is considered to be a shallow comparision.  This
allowed distinctly small possibilities that two files being
compared could be different but not caught.

We now use go-mtree to do the comparison.  This can emulate the
shallow comparison we had before but we can also adding a
sha256digest as part of the comparison using the new --keywords
option.

Also, made slight tweaks to gomtree functions in Atomic.util
so we debug and influence the return of JSON data.

This solves https://github.com/projectatomic/atomic/issues/761

Closes: #777
Approved by: rhatdan
2016-12-05 15:08:01 +00:00
Brent Baude
c10c5f0b1a Atomic Info Unittests
Add unittests for ostree, docker backends for the version
sub-verb to images.

Closes: #774
Approved by: rhatdan
2016-11-30 17:11:24 +00:00
Brent Baude
ef984ed066 Refactor images
Covers all but verify and generate.  This is a refactoring of the
images subverbs (i.e. info, version, delete, ...)

Added in a unittest for list and info.

Closes: #771
Approved by: baude
2016-11-29 21:47:05 +00:00
Dan Walsh
a67082f3e4 The HELP label by default should be "help"
But we want to check for all cases.  Currently if a image uses the
standard help label, atomic will fail to find it.

Closes: #754
Approved by: rhatdan
2016-11-28 21:01:09 +00:00
yuqi-zhang
4c4d855e1e Minor fix to delete
Change --storage flag to not conflict with -f, and update some tests
to not error on some duplicate storage.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #768
Approved by: giuseppe
2016-11-25 09:23:25 +00:00
Jonathan Lebon
75726671d8 test_util.py: adapt for newer sepolicies
In Fedora 25, the default container context changed to
'container_file_t'. Adapt the unit test accordingly.

Closes: #766
Approved by: rhatdan
2016-11-22 19:27:43 +00:00
yuqi-zhang
148be22083 syscontainers: add rollback
Add --rollback flag to atomic update, which switches a system
container to the other deployment if one exists.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #762
Approved by: rhatdan
2016-11-22 19:17:17 +00:00
Brent Baude
16c761447c backends: has image|container return objects
If the has_image|has_container evals to True, then return
the proper object; else None

Add unittest structure for backends/backendutils.py

We want to make sure we have a good backend/backendutils
unittest.  This should simplify unittests for all backends.

refactor.py: Remove the file used to help mini-test the
refactoring work.  It is not needed by upstream and was
only including during the development phases.

Closes: #757
Approved by: baude
2016-11-22 15:38:13 +00:00
Brent Baude
8971501f13 Atomic/mount.py: shutil.rmtree input must be dir
The unmount function for system containers was failing
for images that had regular files in its / directory
because shutil.rmtree was being used.  The rmtree method
requires its input to a path of type dir.  Added a simple
condition to check the input path and use os.remove(path)
on files.

Closes: #759
Approved by: rhatdan
2016-11-21 15:32:09 +00:00
Brent Baude
121435f1cc Use centos for all test images
To download less images, we now just used centos for the
base of all atomic-test images

Closes: #759
Approved by: rhatdan
2016-11-21 15:32:09 +00:00
Brent Baude
552e3f3bcb atomic diff: Add ability to compare metadata
With the -m switch, we can now compare the metadata between
the two diff objects.  We report only the differences between them. All
common data is deleted from the object structures.

This solves --> https://github.com/projectatomic/atomic/issues/760

Closes: #764
Approved by: baude
2016-11-18 21:22:51 +00:00
Dan Walsh
656ade8846 Cleanup handling of dbus calls and test client.
Closes: #723
Approved by: rhatdan
2016-10-24 21:39:23 +00:00
Dan Walsh
f9c6571c78 Don't switch to json, let dbus handle this
Closes: #723
Approved by: rhatdan
2016-10-24 21:39:23 +00:00
Dan Walsh
b110e73c88 Refactor Trust code to work with dbus interface
Closes: #723
Approved by: rhatdan
2016-10-24 21:39:23 +00:00
yuqi-zhang
fb3779349e Add --storage option to image-related commands
Add an optional --storage flag to the following commands:
 - images delete
 - info
 - mount
 - verify
 - version

If specified, the command will only look at the specified storage
(ostree/docker) for the image to perform the action. If not
specified, the command will look through both ostree/docker for
the image (as it was before). However, if the storage is not
specified and the image exists in both ostree and docker, the
command will error and prompt the user to specify. Image inspection
also no longer forces the user to delete/rename one or the other.

This is meant to address the duplicate naming issue (where a user
can have an image in both ostree and docker with the same name).

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #720
Approved by: giuseppe
2016-10-24 09:27:00 +00:00
petervo
ab30d45a24 syscontainers: Fix docker: and dockertar: installs
Closes: #721
Approved by: rhatdan
2016-10-23 10:19:04 +00:00
Brent Baude
07d4e01c6b Atomic/verify.py: Smooth out verify issues
Several long-term issues existed for verify including some
munging of information between layers under certain
conditions.  This PR addresses these issues by simplifying
the way things are to be inspected.

Example output as follows:

```
$ atomic verify docker.io/library/busybox
$ atomic verify docker.io/ubuntu

docker.io/ubuntu:latest contains the following images:

NAME                           LOCAL VERSION        REMOTE VERSION       DIFFERS
docker.io/ubuntu:latest        44776f55294a30e89d6a f753707788c5c100f194 Yes

registry.access.redhat.com/rhel7/rsyslog:latest contains the following images:

NAME                           LOCAL VERSION        REMOTE VERSION       DIFFERS
rhel7/rsyslog                  rhel7/rsyslog-7.2-21 rhel7/rsyslog-7.2-29 Yes
rhel7/rhel                     rhel7/rhel-7.2-56    rhel7/rhel-7.2-104   Yes

$
```

Closes: #714
Approved by: baude
2016-10-19 20:41:49 +00:00
Giuseppe Scrivano
f869faf2c1 tests: enable again syscontainers test
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #711
Approved by: rhatdan
2016-10-18 12:16:57 +00:00
Brent Baude
112abcf2ac Atomic/info.py: Fix info and version
The atomic image version subcommand was broken.  Among the issues
was it called the wrong method, attempted to obtain the image
if not locally present, and outputted incorrect information. Some
of the problems were described in:

     https://github.com/projectatomic/atomic/issues/708

The version method has been redone to obtain the correct information.  It
no longer attempts to obtain the image if not present. It raises an
error.

Also, moved the version method into info and performed a pep8 clean up.

Example output now appears like:

```
atomic --debug version -r docker.io/busybox

IMAGE NAME                                     VERSION   IMAGE ID
10.3.11.254:5000/baude/busybox:latest          None      e02e811dd08f
  Tag: docker.io/busybox:latest
  Tag: localhost:5000/busybox:latest

atomic --debug version -r registry.access.redhat.com/rhel7/rsyslog

IMAGE NAME                                               VERSION                IMAGE ID
registry.access.redhat.com/rhel7/rsyslog:latest          rhel7/rsyslog-7.2-21   53f20e902da7
registry.access.redhat.com/rhel7.2:7.2-56                rhel7/rhel-7.2-56      1a9b3357bac5

```

Closes: #710
Approved by: baude
2016-10-14 19:53:03 +00:00
Aaron Weitekamp
6d909022fc trust show GPG key ID
Closes: #702
Approved by: rhatdan
2016-10-13 20:59:03 +00:00
Aaron Weitekamp
8d23c2bffa remove sigstore config with trust delete 2016-10-13 13:34:20 -04:00
Jonathan Lebon
49f2f9ff64 test_printenv.sh: use realpath
Otherwise the $PWD env var will not match.

Closes: #684
Approved by: cgwalters
2016-10-13 16:37:01 +00:00
Jonathan Lebon
d04d3aa454 test_help.sh: check for groff before testing
Atomic Host variants do not have groff (and most likely never will since
it would pull in a lot of Perl packages). Print out a nicer error if
we're on AH, and make sure to skip that test.

Closes: #684
Approved by: cgwalters
2016-10-13 16:37:01 +00:00
Brent Baude
4aa4318c29 decompose: Add ability to decompose image w/digest
Adding the ability to decompose an input image "name" that
includes a digest. For example:

docker.io/library/fedora@sha256:64a02df6aac27d1200c2572fe4b9949f1970d05f74d367ce4af994ba5dc3669e

Also, reword the decompose method in a Decompose class.  This simplifies the use of
decomposition and allows for growth.

Example usage:
   registry, repo, image, tag, digest = Decompose("docker.io/library/busybox:latest").all
   repo = Decompose("docker.io/library/busybox:latest").repo
   digest = Decompose("docker.io/fedora@sha256:64a02df6aac27d1200c2...67ce4af994ba5dc3669e").digest

Closes: #701
Approved by: rhatdan
2016-10-13 12:23:37 +00:00
Brent Baude
adc8956f50 Allow pull from registry not in docker conf
We now allow pulls from registries that are not in
the docker configuration file.  This altered our
decompose method a bit.  We now check the registry
in decompose to see if it resolves on the network.
If so, then we use it.

Closes: #693
Approved by: baude
2016-10-11 13:23:58 +00:00
Dan Walsh
217bc6288c Add dbus support for atomic pull
Closes: #682
Approved by: rhatdan
2016-10-08 09:56:20 +00:00
Dan Walsh
57a223b401 Add dbus support for atomic top.
Also add missing force qualifier for ContainersDelete

Closes: #682
Approved by: rhatdan
2016-10-08 09:56:20 +00:00
Brent Baude
aa59a5e285 Introduce registry inspect methods
Add two classes and several new methods for inspecting
registries and images.  These methods are helpful
for:

* taking user input (i.e. image names, partial image names) and determining
the fully qualified names.
* determining the fq name when the registry is omitted by the user.
* obtaining image manifests
* mimicing skopeo inspect

Closes: #687
Approved by: baude
2016-10-07 19:54:35 +00:00
Giuseppe Scrivano
ad82d64520 syscontainers: allow to specify image id by its prefix
Raise an error if there are more images matching the same prefix.

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

Closes: #683
Approved by: rhatdan
2016-10-06 11:07:34 +00:00
Brent Baude
e83c2c5dd8 Atomic.util: More robust decompose
Colleagues asked for decompose to be improved to where it took
an image name and broke it into registry, repo, image, and tag.
It also should mimic docker's implementation where 'library' is a known
exception

Also added unittests for decompose.  Removed a singular glob  test
as it is no longer valid

Closes: #677
Approved by: rhatdan
2016-10-05 17:00:11 +00:00
yuqi-zhang
075035a052 version: save and display system image info
Save labels from docker manifest into ostree, so when a user invokes
'atomic version' on a system image, the metadata info is displayed,
same as docker images.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #679
Approved by: giuseppe
2016-10-05 12:36:57 +00:00
Dan Walsh
c0256dcfe6 Implement dbus interface for atomic commands
Add missing interfaces.

Fix functions to return text, rather then displaying directly.

Change atomic_client.py to take input from command line. These args are translated into function calls in python.

Add tests scripts in tests/integration/dbus directory

Closes: #668
Approved by: rhatdan
2016-10-04 14:31:42 +00:00
Giuseppe Scrivano
fc0aea92ea syscontainers: remove tmpfiles conf file on error
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #665
Approved by: rhatdan
2016-09-27 12:40:18 +00:00
yuqi-zhang
3e55ad6621 Start/stop syscontainers with atomic run/stop
Wrap atomic run/stop with systemctl start/stop for system
containers. This way the user can directly use the atomic
CLI for the full container cycle. In addition, the equivalent
functionality already exists for docker containers, so it
makes sense to allow system containers to start/stop in a
similar fashion.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #651
Approved by: rhatdan
2016-09-21 20:56:13 +00:00
Giuseppe Scrivano
57a0546010 syscontainers: store full image name
store the full image name, registry included, when pulling an image.

Some characters in the url are not usable for the name of an OSTree
ref, so escape them with '_'.  This change breaks old images already
pulled.

use "rm -rf /ostree/repo/refs/heads/ociimage" and pull the images
again.

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

Closes: #620
Approved by: cgwalters
2016-09-21 19:33:16 +00:00
Brent Baude
f60218a679 Atomic/pull.py: Set docker as default backend
Setting docker as the default backend instead of ostree.

Closes: #637
Approved by: rhatdan
2016-09-20 16:07:32 +00:00
Aaron Weitekamp
0870507325 add atomic trust show
Closes: #629
Approved by: rhatdan
2016-09-20 08:48:20 +00:00
Aaron Weitekamp
b66284fb81 refactor trust
Closes: #629
Approved by: rhatdan
2016-09-20 08:48:20 +00:00
Aaron Weitekamp
dbba71243e update based on comments
Closes: #599
Approved by: rhatdan
2016-09-19 13:33:16 +00:00
Aaron Weitekamp
943c984d4c refactor trust
Closes: #599
Approved by: rhatdan
2016-09-19 13:33:16 +00:00
yuqi-zhang
ddabf2715f syscontainers: display better container status
Change the status in "atomic containers list" to display systemd
state instead of runc state. This way system containers match user
containers. Another reason for the switch is that systemctl
start/stop creates/destroys a runc container every time instead of
using the same container, so systemd gives better indication of
container status.

Also expand the states to be:

 - running: container is running correctly
 - inactive: container is stopped/newly created and ready to run
 - failed: either systemd service or container process failed

instead of just "exited" and "running" as before.

Add tests and fix to test-image originally by Giuseppe.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #619
Approved by: giuseppe
2016-09-16 08:05:49 +00:00
Aaron Weitekamp
6f016d7854 add test registries.d configs
Closes: #604
Approved by: baude
2016-09-15 14:24:49 +00:00
Aaron Weitekamp
fe2aab7b7c add default policy.json for tests
Closes: #604
Approved by: baude
2016-09-15 14:24:49 +00:00
Aaron Weitekamp
60e073d80e add default policy trust arg
Closes: #604
Approved by: baude
2016-09-15 14:24:49 +00:00
Aaron Weitekamp
7c53602688 update trust based on review feedback
Closes: #604
Approved by: baude
2016-09-15 14:24:49 +00:00
Aaron Weitekamp
0c69d7942f add trust unittests
Closes: #604
Approved by: baude
2016-09-15 14:24:49 +00:00
Aaron Weitekamp
1d4466e2c4 add basic unittests
Closes: #604
Approved by: baude
2016-09-15 14:24:49 +00:00
Dan Walsh
f3c036888b Fix test cases using atomic -y ...
Previous patch broke test cases

Closes: #602
Approved by: rhatdan
2016-09-12 20:41:50 +00:00
Giuseppe Scrivano
085ec47e3d syscontainers: keep a copy of the installed files
It is useful in case of reverting to an old version.  We may want to
do this automatically, without any manual intervention.

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

Closes: #596
Approved by: rhatdan
2016-09-08 14:07:20 +00:00
Colin Walters
b924c7d843 syscontainers: Don't start on install
Interactive users or deployment systems may want to perform
configuration before starting.  For example, I may want to configure
the flannel data in etcd before starting flannel.

This topic comes up a lot in the RPM/deb worlds too; most RPM
distributions are inconsistent about this, whereas Debian basically
never starts a service on package install.

I think also it's better to teach admins to use systemd for service
management directly.

(This commit also changes things so we only `enable` on initial install,
 which is a minor tweak)

Closes: #584
Approved by: rhatdan
2016-09-06 20:25:51 +00:00