Revision 75ae8a08 kamaki/cli/commands/cyclades.py

b/kamaki/cli/commands/cyclades.py
474 474
            'If neither --network or --no-network are used, the default '
475 475
            'network policy is applied. These policies are set on the cloud, '
476 476
            'so kamaki is oblivious to them',
477
            '--no-network')
477
            '--no-network'),
478
        project=ValueArgument('Assign the server to project', '--project'),
478 479
    )
479 480
    required = ('server_name', 'flavor_id', 'image_id')
480 481

  
481 482
    @errors.cyclades.cluster_size
482
    def _create_cluster(self, prefix, flavor_id, image_id, size):
483
    def _create_cluster(self, prefix, flavor_id, image_id, size, project=None):
483 484
        networks = self['network_configuration'] or (
484 485
            [] if self['no_network'] else None)
485 486
        servers = [dict(
486 487
            name='%s%s' % (prefix, i if size > 1 else ''),
487 488
            flavor_id=flavor_id,
488 489
            image_id=image_id,
490
            project=project,
489 491
            personality=self['personality'],
490 492
            networks=networks) for i in range(1, 1 + size)]
491 493
        if size == 1:
......
518 520
    @errors.cyclades.flavor_id
519 521
    def _run(self, name, flavor_id, image_id):
520 522
        for r in self._create_cluster(
521
                name, flavor_id, image_id, size=self['cluster_size'] or 1):
523
                name, flavor_id, image_id, size=self['cluster_size'] or 1,
524
                project=self['project']):
522 525
            if not r:
523 526
                self.error('Create %s: server response was %s' % (name, r))
524 527
                continue
......
657 660

  
658 661

  
659 662
@command(server_cmds)
663
class server_reassign(_init_cyclades, _optional_json):
664
    """Assign a VM to a different project
665
    """
666

  
667
    @errors.generic.all
668
    @errors.cyclades.connection
669
    @errors.cyclades.server_id
670
    def _run(self, server_id, project):
671
        self.client.reassign_server(server_id, project)
672

  
673
    def main(self, server_id, project):
674
        super(self.__class__, self)._run()
675
        self._run(server_id=server_id, project=project)
676

  
677

  
678
@command(server_cmds)
660 679
class server_delete(_init_cyclades, _optional_output_cmd, _server_wait):
661 680
    """Delete a virtual server"""
662 681

  

Also available in: Unified diff