Revision c17b8bc0 kamaki/cli/commands/cyclades_cli.py

b/kamaki/cli/commands/cyclades_cli.py
94 94
            print('%s (%s)' % (sid, bold(sname)))
95 95
            if self.get_argument('detail'):
96 96
                self._info_print(server)
97
                print(' ')
98 97

  
99 98
    def main(self):
100 99
        super(self.__class__, self).main()
......
315 314
            raiseCLIError(err, 'Server id must be positive integer', 1)
316 315
        except Exception as err:
317 316
            raiseCLIError(err)
318
        print_list(reply, with_enumeration=True)
317
        print_list(reply, with_enumeration=len(reply) > 1)
319 318

  
320 319

  
321 320
@command(server_cmds)
......
443 442
        for i, flavor in enumerate(flist):
444 443
            print(bold('%s. %s' % (i, flavor['name'])))
445 444
            print_dict(flavor, exclude=('name'), ident=1)
446
            print(' ')
447 445

  
448 446
    def main(self):
449 447
        super(self.__class__, self).main()
......
470 468

  
471 469

  
472 470
@command(network_cmds)
471
class network_info(_init_cyclades):
472
    """Get network details"""
473

  
474
    @classmethod
475
    def print_network(self, net):
476
        if 'attachments' in net:
477
            att = net['attachments']['values']
478
            count = len(att)
479
            net['attachments'] = att if count else None
480
        print_dict(net, ident=1)
481

  
482
    def main(self, network_id):
483
        super(self.__class__, self).main()
484
        try:
485
            network = self.client.get_network_details(network_id)
486
        except Exception as err:
487
            raiseCLIError(err)
488
        network_info.print_network(network)
489

  
490

  
491
@command(network_cmds)
473 492
class network_list(_init_cyclades):
474 493
    """List networks"""
475 494

  
......
523 542

  
524 543

  
525 544
@command(network_cmds)
526
class network_info(_init_cyclades):
527
    """Get network details"""
528

  
529
    @classmethod
530
    def print_network(self, net):
531
        if 'attachments' in net:
532
            att = net['attachments']['values']
533
            net['attachments'] = att if len(att) > 0 else None
534
        print_dict(net, ident=1)
535

  
536
    def main(self, network_id):
537
        super(self.__class__, self).main()
538
        try:
539
            network = self.client.get_network_details(network_id)
540
        except Exception as err:
541
            raiseCLIError(err)
542
        network_info.print_network(network)
543

  
544

  
545
@command(network_cmds)
546 545
class network_rename(_init_cyclades):
547 546
    """Update network name"""
548 547

  

Also available in: Unified diff