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
A 'high-level' unit test is added that covers basic functionality
check for refactored function '_handle_system_package_files'.
Closes: #1155
Approved by: giuseppe
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
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
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
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
In _do_checkout, we refactor the part for getting rootfs location
into a function.
A todo comment( refactoring 'missing image layer check') is also added
in this commit based on discussions on irc
A unit test is added for future regression
Closes: #1154
Approved by: giuseppe
This is regression from https://github.com/projectatomic/atomic/pull/1152.
It appears that 'self' is no longer used when '_resolve_remote_path' is moved into
'_get_remote_location'. Thus, '_get_remote_location' is made to be static
Closes: #1154
Approved by: giuseppe
Made a new class to track all the refactored functions' unit tests
(for future usage)
Added a unit test to test the functionality of the factored out
_get_remote_location function.
Closes: #1152
Approved by: giuseppe
The atomic.conf file is now tested to validate it is valid YAML. The two
cases checked are:
- The file contents in it's shipped state
- The file contents with examples uncommented
An example has no space between the hash and the start of the example:
#example: value
While a comment is expected to have a space:
# I am a comment
Closes: #1009
Approved by: giuseppe
Ideally atomic will be able to run multiple container
runtimes. In and effort to do so, we must have a concept
of a global registries configuration file which will allow
us to pull images with atomic and skopeo. The tooling
that parses the global configuration file is:
https://github.com/projectatomic/registries
This is step one in the implementation of this tooling
and direction.
Closes: #1003
Approved by: rhatdan
http_proxy and https_proxy are currently supported in /etc/atomic.conf.
This change adds no_proxy support. no_proxy is for urls which should
not go through a proxy.
Closes: #999
Approved by: baude
When the repo namespaces are unknown and the registry is docker.io, the
default value "library" should be used.
This matters when specifying library images in the shortest form, e.g.
"busybox:latest"; we would be fetching
docker://docker.io/busybox:latest instead of
docker://docker.io/library/busybox:latest.
skopeo would normalize that when fetching anyway, but this makes the output more
regular (which, in particular, matters for looking up
registries.d/*.yaml entries) and more consistent with the “fully
qualified domain(?) name” terminology.
Most importantly, the docker/distribution reference recorded inside the
signature should use the fully expanded form for maximum semantic
clarity.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Closes: #937
Approved by: baude
We shouldn't do anything at module import time, as that happens during builds,
where we don't want to touch the host system (and may not have privileges to do
so).
This required some refactoring of the locking code too, as simply
instantiating the decorator was creating files too.
Closes: https://github.com/projectatomic/atomic/issues/963
Closes: #966
Approved by: rhatdan
When installing an image, we now write a small bit of json
to /var/lib/atomic/install.json. The json format is:
{
<image_name>: {
id: <image_id>,
install_date: <install_date_in_utc
}
}
This will be used in update, run, etc to ensure that any image
with an INSTALL label is first installed.
Closes: #950
Approved by: giuseppe
allow the $ORIGIN: prefix only when the branch is specified, otherwise it
is not decidable if $ORIGIN is the source to pull the image from or the
name of the image itself.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #767
Approved by: rhatdan
I've observed some failures when running "make check", mock the function
to return something useful.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #893
Approved by: baude
Fix a slew of issues related to deletion of images and containers. Also
added --assume_yes to be consistent with other commands. This will benefit
dbus interaction as well given that we do not want confirmation occuring
over dbus.
Issues that were fixed:
* Proper catch and error for trying to delete all images|containers when no images|containers exist
* Catch and error when no image|container is given by user and no --all
* when --storage and --all are used, only images|containers in that backend are now deleted
* when --all is given but not --storage, all images|containers from all backends are now deleted.
* Fixed logical error when deleting containers
* Deletion of images|containers now is consistent in its confirm and abort messages.
Added unittests.
Closes: #864
Approved by: rhatdan
Added two tests for pull by digest: one where the image is not
present and the other when it is.
Also, addressed review comments.
Closes: #856
Approved by: baude
There is a python bug that in 2.7.5 that is causing
the unittest failures on centos_atomic. The bug
is related to how regex is compiled and used.
Adding a simple decorator to skip tests that fail
because of that in the trust tests.
Closes: #848
Approved by: baude
Refactor several of the atomic verbs and subverbs to take advantage
of object refactoring.
Also, do not pull images with skopeo if the local image is already
at the latest.
$ sudo python ./atomic --debug pull busybox
Namespace(_class=<class 'Atomic.pull.Pull'>, assumeyes=False, debug=True, func='pull_image', image='busybox', reg_type=None, storage='docker')
Latest version of busybox already present.
Closes: #825
Approved by: baude
With the exception of fstrim, the containers verb has now been
refactored. It primarily now uses the containers object in its
implementation.
Closes: #792
Approved by: rhatdan
Using our refactoring model, verify is now streamlined. We no longer
compare base images as that is not currently possible for both
V1 and V2 schemas.
Verify will now always look at the release and version labels for
comparison. Should those labels not exist, it will use the
manifest digest for ostree; and it will use the image IDs for
docker.
Closes: #785
Approved by: rhatdan
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
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
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
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
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
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
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