1
0
mirror of https://github.com/projectatomic/atomic.git synced 2026-02-07 06:44:52 +01:00
Commit Graph

12 Commits

Author SHA1 Message Date
Brent Baude
8028c33e00 Introduction of ContainersStorage backend
A new backend is being added to the Atomic CLI called "Containers Storage".  This commit
covers the addition of the backend itself.  The backend is only made available in the
atomic CLI if an export variable called 'DEV' is found.  For example:

sudo DEV=true atomic images list -a

Each method in the backend (with the exceptionof def available) raises an
UnderDevelopment Exception.  As the methods are developed, the exceptions will be removed.

Closes: #1038
Approved by: rhatdan
2017-06-28 15:34:36 +00:00
Brent Baude
8fafc5feeb Account for API Changes in docker-py-2
The new 2.x version of the docker python API has non-backward
compatible changes.  These changes are described here:

https://docker-py.readthedocs.io/en/stable/change-log.html#breaking-changes

We need to account for docker.Client and docker.APIClient as well
as changes in the way kwargs are handled.  Also, it appears the
AutoVersion method is deprecated.

Closes: #894
Approved by: rhatdan
2017-02-21 14:17:51 +00:00
Brent Baude
02bd134f1c Add --storage to install|run
To have parity function with pull, we need to add --storage
to install and run.  This allows for overriding when atomic.type
is defined.  For example, if you pull an image that has
atomic.type=system but you really want to store it
on the docker backend.

Closes: #861
Approved by: baude
2017-02-04 17:05:24 +00:00
Brent Baude
3d2acc23e8 Detect and install systemcontainer images
If an image from a registry has a label like:

    atomic.type=system

the Atomic CLI will now detect that prior to pulling
the image.  It will then switch the backend storage
to ostree.  In the case of install, it will both
pull to ostree and install it.

If the backend is switched, a message informing the user
as such will be shown.

The detection and switch of the backend can be overriden
 with the --storage option.

The following is an example of install:

$ sudo atomic install atomic-registry.usersys.redhat.com:5000/brentbaude/helloworld:latest

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.

Extracting to /var/lib/containers/atomic/helloworld.0
systemctl daemon-reload
systemctl enable helloworld

$ sudo ./atomic images list
   REPOSITORY                                                      TAG      IMAGE ID       CREATED            VIRTUAL SIZE   TYPE
   atomic-registry.usersys.redhat.com:5000/brentbaude/helloworld   latest   0056366e4ebd   2017-02-01 18:04                  ostree

$ sudo ./atomic containers list -a
   CONTAINER ID IMAGE                COMMAND              CREATED          STATE     BACKEND    RUNTIME
   helloworld   atomic-registry.user /usr/bin/run.sh      2017-02-01 18:04 failed    ostree     runc

Closes: #861
Approved by: baude
2017-02-04 17:05:24 +00:00
Brent Baude
f79d56bd13 Disconnect backends
Ideally, the atomic CLI should be able to operate independently
of the backends it supports.  For example, if dockerd is inactive,
the ostree backend and atomic cli should still work.

This requires some tweaking to the backendutils code and the work
flow.  We also need to specifically know if the user passes
--storage so that we treat that as an explicit override.  The work
flow is now roughly:

* a default storage can be defined in atomic.conf (was always this way)
* if not defined, defaults to docker.
* if --storage is passed, treat explictly and fail if cannot execute
* if no --storage is specified, use default.  if default is not available, move
 onto the next backend.
2017-01-25 19:07:20 -06:00
Brent Baude
9f6612a9a2 Refactor atomic stop
Refactoring of atomic stop to use container objects and the new backend
methods.

Closes: #798
Approved by: rhatdan
2016-12-14 15:45:39 +00:00
Brent Baude
e405c6a048 Refactor containers verb
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
2016-12-09 14:05:49 +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
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
Giuseppe Scrivano
35dceef3e1 backends: add skeleton for ostree backend
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

backend: fix pylint issues for ostree backend

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

Add layer object, image object updates, pylint

layer.py: Add layer object
image.py: Add fq name propert, image equality methods, and remote inspection.
backends.py: Begin documentation of common methods
_docker.py: Adding methods: pull, make_remote_image, layers
Full pylint run and cleanups.  Passes all tests.

Closes: #757
Approved by: baude
2016-11-22 15:38:13 +00:00
Brent Baude
5e4ef83304 Add refactoring structure
Atomic/backendutils.py: Class for working with unknown backend
Atomic/objects/image|layer|container.py: classes for objects
Atomic/backends/backend|_docker|_ostree.py: Abstract backends for ostree and docker

Closes: #757
Approved by: baude
2016-11-22 15:38:13 +00:00