Revision 5b4e563f kamaki/cli/commands/cyclades.py
b/kamaki/cli/commands/cyclades.py | ||
---|---|---|
264 | 264 |
"""Detailed information on a Virtual Machine""" |
265 | 265 |
|
266 | 266 |
arguments = dict( |
267 |
addr=FlagArgument(
|
|
267 |
nics=FlagArgument(
|
|
268 | 268 |
'Show only the network interfaces of this virtual server', |
269 | 269 |
'--nics'), |
270 |
network_id=ValueArgument( |
|
271 |
'Show the connection details to that network', '--network-id'), |
|
270 | 272 |
vnc=FlagArgument( |
271 | 273 |
'Show VNC connection information (valid for a short period)', |
272 | 274 |
'--vnc-credentials'), |
... | ... | |
277 | 279 |
@errors.cyclades.connection |
278 | 280 |
@errors.cyclades.server_id |
279 | 281 |
def _run(self, server_id): |
280 |
vm = self.client.get_server_details(server_id)
|
|
281 |
if self['addr']:
|
|
282 |
vm = self.client.get_server_nics(server_id)
|
|
283 |
if self['nics']:
|
|
282 | 284 |
self._print(vm.get('attachments', [])) |
285 |
elif self['network_id']: |
|
286 |
self._print( |
|
287 |
self.client.get_server_network_nics( |
|
288 |
server_id, self['network_id']), self.print_dict) |
|
283 | 289 |
elif self['vnc']: |
284 | 290 |
self.error( |
285 | 291 |
'(!) For security reasons, the following credentials are ' |
... | ... | |
298 | 304 |
|
299 | 305 |
def main(self, server_id): |
300 | 306 |
super(self.__class__, self)._run() |
301 |
choose_one = ('addr', 'vnc', 'stats')
|
|
307 |
choose_one = ('nics', 'vnc', 'stats')
|
|
302 | 308 |
count = len([a for a in choose_one if self[a]]) |
303 | 309 |
if count > 1: |
304 | 310 |
raise CLIInvalidArgument('Invalid argument compination', details=[ |
... | ... | |
728 | 734 |
|
729 | 735 |
|
730 | 736 |
@command(server_cmds) |
731 |
class server_addr(_init_cyclades):
|
|
737 |
class server_nics(_init_cyclades):
|
|
732 | 738 |
"""DEPRECATED, use: [kamaki] server info SERVER_ID --nics""" |
733 | 739 |
|
734 | 740 |
def main(self, *args): |
Also available in: Unified diff