Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

[merged] Fix version #634

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions Atomic/info.py
Expand Up @@ -28,14 +28,18 @@ def cli_version(subparser):
versionp.add_argument("-r", "--recurse", default=False, dest="recurse",
action="store_true",
help=_("recurse through all layers"))
versionp.set_defaults(_class=Info, func='info')
versionp.set_defaults(_class=Info, func='version')
versionp.add_argument("image", help=_("container image"))


class Info(Atomic):
def __init__(self):
super(Info, self).__init__()

def version(self):
self.args.force_remote_info = False
self.info()

def info(self):
"""
Retrieve and print all LABEL information for a given image.
Expand All @@ -46,7 +50,10 @@ def _no_label():
# Check if the input is an image id associated with more than one
# repotag. If so, error out.
if self.syscontainers.has_system_container_image(self.image):
pass
if not self.args.force_remote_info:
version = self.syscontainers.version(self.image)
util.write_out('{0}: {1}'.format(self.image, version))
return
elif self.is_iid():
self.get_fq_name(self._inspect_image())
# The input is not an image id
Expand Down
6 changes: 6 additions & 0 deletions Atomic/syscontainers.py
Expand Up @@ -509,6 +509,12 @@ def _get_ostree_repo(self):
repo.open(None)
return repo

def version(self, image):
image_inspect = self.inspect_system_image(image)
if image_inspect:
return image_inspect['ImageId']
return None

def update_system_container(self, name):
repo = self._get_ostree_repo()
if not repo:
Expand Down