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