Merge "Make replication controller client works"
This commit is contained in:
		| @@ -18,7 +18,7 @@ import testtools | ||||
| from testtools import matchers | ||||
| 
 | ||||
| from magnumclient.tests import utils | ||||
| from magnumclient.v1 import replicationcontroller as rc | ||||
| from magnumclient.v1 import replicationcontrollers as rcs | ||||
| 
 | ||||
| 
 | ||||
| RC1 = {'id': 123, | ||||
| @@ -77,7 +77,7 @@ class RCManagerTest(testtools.TestCase): | ||||
|     def setUp(self): | ||||
|         super(RCManagerTest, self).setUp() | ||||
|         self.api = utils.FakeAPI(fake_responses) | ||||
|         self.mgr = rc.ReplicationControllerManager(self.api) | ||||
|         self.mgr = rcs.ReplicationControllerManager(self.api) | ||||
| 
 | ||||
|     def test_rc_list(self): | ||||
|         rcs = self.mgr.list() | ||||
| @@ -22,7 +22,7 @@ from magnumclient.v1 import bays | ||||
| from magnumclient.v1 import containers | ||||
| from magnumclient.v1 import nodes | ||||
| from magnumclient.v1 import pods | ||||
| from magnumclient.v1 import replicationcontroller as rc | ||||
| from magnumclient.v1 import replicationcontrollers as rcs | ||||
| from magnumclient.v1 import services | ||||
|  | ||||
|  | ||||
| @@ -80,7 +80,7 @@ class Client(object): | ||||
|         self.containers = containers.ContainerManager(self.http_client) | ||||
|         self.nodes = nodes.NodeManager(self.http_client) | ||||
|         self.pods = pods.PodManager(self.http_client) | ||||
|         self.rc = rc.ReplicationControllerManager(self.http_client) | ||||
|         self.rcs = rcs.ReplicationControllerManager(self.http_client) | ||||
|         self.services = services.ServiceManager(self.http_client) | ||||
|  | ||||
|     def get_keystone_client(self, username=None, api_key=None, auth_url=None, | ||||
|   | ||||
| @@ -17,7 +17,7 @@ from magnumclient.common import utils | ||||
| from magnumclient import exceptions | ||||
| 
 | ||||
| 
 | ||||
| CREATION_ATTRIBUTES = ['rc_definition_url'] | ||||
| CREATION_ATTRIBUTES = ['bay_uuid', 'rc_definition_url', 'rc_data'] | ||||
| 
 | ||||
| 
 | ||||
| class ReplicationController(base.Resource): | ||||
| @@ -241,14 +241,27 @@ def do_rc_list(cs, args): | ||||
|                      {'versions': _print_list_field('versions')}) | ||||
|  | ||||
|  | ||||
| @utils.arg('--rc-file', | ||||
|            metavar='<rc-file>', | ||||
| @utils.arg('--rc-url', | ||||
|            metavar='<rc_url>', | ||||
|            help='Name/URL of the replication controller file to use for ' | ||||
|                 'creating replication controllers.') | ||||
| @utils.arg('--rc-file', | ||||
|            metavar='<rc_file>', | ||||
|            help='File path of the replication controller file to use for ' | ||||
|                 'creating replication controllers.') | ||||
| @utils.arg('--bay-id', | ||||
|            required=True, | ||||
|            metavar='<bay_id>', | ||||
|            help='The bay ID.') | ||||
| def do_rc_create(cs, args): | ||||
|     """Create a replication controller.""" | ||||
|     opts = {} | ||||
|     opts['rc_definition_url'] = args.rc_file | ||||
|     opts['rc_definition_url'] = args.rc_url | ||||
|     opts['bay_uuid'] = args.bay_id | ||||
|  | ||||
|     if args.rc_file is not None and os.path.isfile(args.rc_file): | ||||
|         with open(args.rc_file, 'r') as f: | ||||
|             opts['rc_data'] = f.read() | ||||
|  | ||||
|     rc = cs.rcs.create(**opts) | ||||
|     _show_rc(rc) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jenkins
					Jenkins