Commit 2afb8137 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Remove "PERMANENTS" from kamaki.cli.cmds classes

Resolves #9

This variable was used only once per case
parent ea8f09c3
......@@ -121,8 +121,6 @@ class server_list(_CycladesInit, OptionalOutput, NameFilter, IDFilter):
Use filtering arguments (e.g., --name-like) to manage long server lists
"""
PERMANENTS = ('id', 'name')
arguments = dict(
detail=FlagArgument('show detailed output', ('-l', '--details')),
since=DateArgument(
......@@ -215,7 +213,7 @@ class server_list(_CycladesInit, OptionalOutput, NameFilter, IDFilter):
pass
else:
for srv in servers:
for key in set(srv).difference(self.PERMANENTS):
for key in set(srv).difference(['id', 'name']):
srv.pop(key)
kwargs = dict(with_enumeration=self['enum'])
......@@ -809,8 +807,6 @@ class server_wait(_CycladesInit, _ServerWait):
class flavor_list(_CycladesInit, OptionalOutput, NameFilter, IDFilter):
"""List available hardware flavors"""
PERMANENTS = ('id', 'name')
arguments = dict(
detail=FlagArgument('show detailed output', ('-l', '--details')),
limit=IntArgument('limit # of listed flavors', ('-n', '--number')),
......@@ -852,7 +848,7 @@ class flavor_list(_CycladesInit, OptionalOutput, NameFilter, IDFilter):
remove_from_items(flavors, 'links')
if detail and not self['detail']:
for flv in flavors:
for key in set(flv).difference(self.PERMANENTS):
for key in set(flv).difference(['id', 'name']):
flv.pop(key)
kwargs = dict(out=StringIO(), title=()) if self['more'] else {}
self.print_(
......
......@@ -123,10 +123,6 @@ def load_image_meta(filepath):
class image_list(_ImageInit, OptionalOutput, NameFilter, IDFilter):
"""List images accessible by user"""
PERMANENTS = (
'id', 'name',
'status', 'container_format', 'disk_format', 'size')
arguments = dict(
detail=FlagArgument('show detailed output', ('-l', '--details')),
container_format=ValueArgument(
......@@ -222,7 +218,9 @@ class image_list(_ImageInit, OptionalOutput, NameFilter, IDFilter):
images = self._add_owner_name(images)
elif detail and not self['detail']:
for img in images:
for key in set(img).difference(self.PERMANENTS):
for key in set(img).difference([
'id', 'name', 'status', 'container_format',
'disk_format', 'size']):
img.pop(key)
kwargs = dict(with_enumeration=self['enum'])
if self['limit']:
......@@ -585,9 +583,6 @@ class image_unregister(_ImageInit):
@command(imagecompute_cmds)
class imagecompute_list(_CycladesInit, OptionalOutput, NameFilter, IDFilter):
"""List images"""
PERMANENTS = ('id', 'name')
arguments = dict(
detail=FlagArgument('show detailed output', ('-l', '--details')),
limit=IntArgument('limit number listed images', ('-n', '--number')),
......@@ -643,7 +638,7 @@ class imagecompute_list(_CycladesInit, OptionalOutput, NameFilter, IDFilter):
images = self._add_name(self._add_name(images, 'tenant_id'))
elif detail and not self['detail']:
for img in images:
for key in set(img).difference(self.PERMANENTS):
for key in set(img).difference(['id', 'name']):
img.pop(key)
kwargs = dict(with_enumeration=self['enum'])
if self['limit']:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment