Revision fac340da

b/kamaki/cli/commands/cyclades.py
748 748

  
749 749
@command(server_cmds)
750 750
class server_wait(_init_cyclades, _server_wait):
751
    """Wait for server to finish [BUILD, STOPPED, REBOOT, ACTIVE]"""
751
    """Wait for server to finish (BUILD, STOPPED, REBOOT, ACTIVE)"""
752 752

  
753 753
    arguments = dict(
754 754
        timeout=IntArgument(
b/kamaki/cli/commands/network.py
478 478
        self._run(port_id=port_id)
479 479

  
480 480

  
481
class PortStatusArgument(ValueArgument):
482

  
483
    valid = ('BUILD', 'ACTIVE', 'DOWN', 'ERROR')
484

  
485
    @property
486
    def value(self):
487
        return getattr(self, '_value', None)
488

  
489
    @value.setter
490
    def value(self, new_status):
491
        if new_status:
492
            new_status = new_status.upper()
493
            if new_status in self.valid:
494
                raise CLIInvalidArgument(
495
                    'Invalid argument %s' % new_status, details=[
496
                    'Status valid values: %s'] % ', '.join(self.valid))
497
            self._value = new_status
498

  
499

  
481 500
class _port_create(_init_network, _optional_json, _port_wait):
482 501

  
483 502
    def connect(self, network_id, device_id):
......
535 554
    """Wait for port to finish [ACTIVE, DOWN, BUILD, ERROR]"""
536 555

  
537 556
    arguments = dict(
557
        current_status=PortStatusArgument(
558
            'Wait while in this status', '--status'),
538 559
        timeout=IntArgument(
539 560
            'Wait limit in seconds (default: 60)', '--timeout', default=60)
540 561
    )
......
551 572
                'status is already %s' % (
552 573
                    port_id, current_status, port['status']))
553 574

  
554
    def main(self, port_id, current_status='BUILD'):
575
    def main(self, port_id):
555 576
        super(self.__class__, self)._run()
577
        current_status = self['current_status'] or self.arguments[
578
            'current_status'].valid[0]
556 579
        self._run(port_id=port_id, current_status=current_status)
557 580

  
558 581

  

Also available in: Unified diff