Include owner and status option in v2 image list
Show the owner and status information when adding -v or --verbose to the image-list command. Closes-bug: #1381514 Change-Id: I90bf622147b12ed157072fad0823af58223caf91
This commit is contained in:
parent
e180dbf12c
commit
6cb26fc2bf
@ -71,7 +71,8 @@ class ShellV2Test(testtools.TestCase):
|
|||||||
'properties': [],
|
'properties': [],
|
||||||
'sort_key': ['name', 'id'],
|
'sort_key': ['name', 'id'],
|
||||||
'sort_dir': ['desc', 'asc'],
|
'sort_dir': ['desc', 'asc'],
|
||||||
'sort': None
|
'sort': None,
|
||||||
|
'verbose': False
|
||||||
}
|
}
|
||||||
args = self._make_args(input)
|
args = self._make_args(input)
|
||||||
with mock.patch.object(self.gc.images, 'list') as mocked_list:
|
with mock.patch.object(self.gc.images, 'list') as mocked_list:
|
||||||
@ -104,7 +105,8 @@ class ShellV2Test(testtools.TestCase):
|
|||||||
'properties': [],
|
'properties': [],
|
||||||
'sort_key': ['name'],
|
'sort_key': ['name'],
|
||||||
'sort_dir': ['desc'],
|
'sort_dir': ['desc'],
|
||||||
'sort': None
|
'sort': None,
|
||||||
|
'verbose': False
|
||||||
}
|
}
|
||||||
args = self._make_args(input)
|
args = self._make_args(input)
|
||||||
with mock.patch.object(self.gc.images, 'list') as mocked_list:
|
with mock.patch.object(self.gc.images, 'list') as mocked_list:
|
||||||
@ -137,7 +139,8 @@ class ShellV2Test(testtools.TestCase):
|
|||||||
'properties': [],
|
'properties': [],
|
||||||
'sort': 'name:desc,size:asc',
|
'sort': 'name:desc,size:asc',
|
||||||
'sort_key': [],
|
'sort_key': [],
|
||||||
'sort_dir': []
|
'sort_dir': [],
|
||||||
|
'verbose': False
|
||||||
}
|
}
|
||||||
args = self._make_args(input)
|
args = self._make_args(input)
|
||||||
with mock.patch.object(self.gc.images, 'list') as mocked_list:
|
with mock.patch.object(self.gc.images, 'list') as mocked_list:
|
||||||
@ -170,7 +173,8 @@ class ShellV2Test(testtools.TestCase):
|
|||||||
'properties': ['os_distro=NixOS', 'architecture=x86_64'],
|
'properties': ['os_distro=NixOS', 'architecture=x86_64'],
|
||||||
'sort_key': ['name'],
|
'sort_key': ['name'],
|
||||||
'sort_dir': ['desc'],
|
'sort_dir': ['desc'],
|
||||||
'sort': None
|
'sort': None,
|
||||||
|
'verbose': False
|
||||||
}
|
}
|
||||||
args = self._make_args(input)
|
args = self._make_args(input)
|
||||||
with mock.patch.object(self.gc.images, 'list') as mocked_list:
|
with mock.patch.object(self.gc.images, 'list') as mocked_list:
|
||||||
|
@ -164,8 +164,12 @@ def do_image_list(gc, args):
|
|||||||
elif not args.sort_dir and not args.sort_key:
|
elif not args.sort_dir and not args.sort_key:
|
||||||
kwargs['sort'] = 'name:asc'
|
kwargs['sort'] = 'name:asc'
|
||||||
|
|
||||||
images = gc.images.list(**kwargs)
|
|
||||||
columns = ['ID', 'Name']
|
columns = ['ID', 'Name']
|
||||||
|
|
||||||
|
if args.verbose:
|
||||||
|
columns += ['owner', 'status']
|
||||||
|
|
||||||
|
images = gc.images.list(**kwargs)
|
||||||
utils.print_list(images, columns)
|
utils.print_list(images, columns)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user