diff --git a/conu/__init__.py b/conu/__init__.py index ab0dd12a..3309e5e0 100644 --- a/conu/__init__.py +++ b/conu/__init__.py @@ -36,6 +36,9 @@ from conu.version import __version__ as version # `conu.version == "3.1.4"` should work as well +# enumerations +from conu.apidefs.backend import CleanupPolicy + # PEP-396 # https://www.python.org/dev/peps/pep-0396/ __version__ = version diff --git a/conu/backend/docker/image.py b/conu/backend/docker/image.py index bbbcb0c4..e3c9e3a6 100644 --- a/conu/backend/docker/image.py +++ b/conu/backend/docker/image.py @@ -458,42 +458,51 @@ def build(cls, path, tag=None, dockerfile=None): return cls(None, identifier=image_id) - def get_layer_ids(self, reversed=True): + def get_layer_ids(self, rev=True): """ Get IDs of image layers - :param reversed: get layers reversed + :param rev: get layers reversed :return: list of strings """ layers = [x['Id'] for x in self.d.history(self.get_id())] - if not reversed: - l = layers.reverse() + if not rev: + layers = layers.reverse() return layers - def layers(self, reversed=True): + def layers(self, rev=True): """ Get list of DockerImage for every layer in image - :param reversed: get layers reversed + :param rev: get layers rev :return: list of DockerImages """ image_layers = [ DockerImage(None, identifier=x, pull_policy=DockerImagePullPolicy.NEVER) for x in self.get_layer_ids() ] - if not reversed: + if not rev: image_layers.reverse() return image_layers class S2IDockerImage(DockerImage, S2Image): - def __init__(self, repository, tag="latest"): + def __init__(self, repository, tag="latest", identifier=None, + pull_policy=DockerImagePullPolicy.IF_NOT_PRESENT, + short_metadata=None): """ :param repository: str, image name, examples: "fedora", "registry.fedoraproject.org/fedora", "tomastomecek/sen", "docker.io/tomastomecek/sen" :param tag: str, tag of the image, when not specified, "latest" is implied + :param identifier: str, unique identifier for this image + :param pull_policy: enum, strategy to apply for pulling the image + :param short_metadata: dict, metadata obtained from `docker.APIClient.images()` """ - super(S2IDockerImage, self).__init__(repository, tag=tag) + super(S2IDockerImage, self).__init__(repository, + tag=tag, + identifier=identifier, + pull_policy=pull_policy, + short_metadata=short_metadata) self._s2i_exists = None def _s2i_command(self, args):