Revision e15d78e2
b/kamaki/cli/commands/__init__.py | ||
---|---|---|
39 | 39 |
|
40 | 40 |
class _command_init(object): |
41 | 41 |
def __init__(self, arguments={}): |
42 |
if not hasattr(self, 'arguments'):
|
|
43 |
self.arguments = {}
|
|
44 |
self.arguments.update(arguments)
|
|
42 |
if hasattr(self, 'arguments'): |
|
43 |
arguments.update(self.arguments)
|
|
44 |
self.arguments = dict(arguments)
|
|
45 | 45 |
try: |
46 |
self.config = self['config'].value
|
|
46 |
self.config = self['config'] |
|
47 | 47 |
#self.config = self.get_argument('config') |
48 | 48 |
except KeyError: |
49 | 49 |
pass |
... | ... | |
89 | 89 |
|
90 | 90 |
:raises KeyError: if argterm not in self.arguments of this object |
91 | 91 |
""" |
92 |
return self.arguments[argterm] |
|
92 |
return self[argterm] |
b/kamaki/cli/commands/cyclades_cli.py | ||
---|---|---|
68 | 68 |
class server_list(_init_cyclades): |
69 | 69 |
"""List servers""" |
70 | 70 |
|
71 |
arguments = dict( |
|
72 |
detail=FlagArgument('show detailed output', '-l') |
|
73 |
) |
|
74 |
|
|
71 | 75 |
def __init__(self, arguments={}): |
72 | 76 |
super(server_list, self).__init__(arguments) |
73 |
self['detail'] = FlagArgument('show detailed output', '-l') |
|
74 | 77 |
|
75 | 78 |
def _info_print(self, server): |
76 | 79 |
addr_dict = {} |
... | ... | |
92 | 95 |
sname = server.pop('name') |
93 | 96 |
sid = server.pop('id') |
94 | 97 |
print('%s (%s)' % (sid, bold(sname))) |
95 |
if self.get_argument('detail'):
|
|
98 |
if self['detail']:
|
|
96 | 99 |
self._info_print(server) |
97 | 100 |
|
98 | 101 |
def main(self): |
99 | 102 |
super(self.__class__, self).main() |
100 | 103 |
try: |
101 |
servers = self.client.list_servers(self.get_argument('detail'))
|
|
104 |
servers = self.client.list_servers(self['detail'])
|
|
102 | 105 |
self._print(servers) |
103 | 106 |
except Exception as err: |
104 | 107 |
raiseCLIError(err) |
Also available in: Unified diff