Remove tripleoclient.baremetal wrapper
The Ironic client now supports the OSC plugin interface directly, so this wrapper is no longer needed. Removing it will allow us to specify which Ironic API version to use via the standard mechanisms. Change-Id: If92855c307ecd389fbe6050e426d0ced959a9665 Depends-On: Icdbd28c487351af6d67205837aa536aedb31b41a
This commit is contained in:
parent
cff4ff4e38
commit
000f67a4c7
|
@ -10,7 +10,7 @@ passlib>=1.6
|
|||
python-ironic-inspector-client>=1.3.0
|
||||
# os-cloud-config>=0.3.1
|
||||
python-heatclient>=0.6.0
|
||||
python-ironicclient>=0.8.0
|
||||
python-ironicclient>=1.1.0 # Apache-2.0
|
||||
python-openstackclient>=2.0.0
|
||||
six>=1.9.0
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
import logging
|
||||
|
||||
from ironicclient import client as ironic_client
|
||||
from openstackclient.common import utils
|
||||
|
||||
|
||||
|
@ -64,33 +63,8 @@ class ClientWrapper(object):
|
|||
|
||||
def __init__(self, instance):
|
||||
self._instance = instance
|
||||
self._baremetal = None
|
||||
self._orchestration = None
|
||||
|
||||
@property
|
||||
def baremetal(self):
|
||||
"""Returns an baremetal service client"""
|
||||
|
||||
# TODO(d0ugal): When the ironicclient has it's own OSC plugin, the
|
||||
# following client handling code should be removed in favor of the
|
||||
# upstream version.
|
||||
|
||||
if self._baremetal is not None:
|
||||
return self._baremetal
|
||||
|
||||
endpoint = self._instance.get_endpoint_for_service_type(
|
||||
"baremetal",
|
||||
region_name=self._instance._region_name,
|
||||
)
|
||||
|
||||
token = self._instance.auth.get_token(self._instance.session)
|
||||
|
||||
self._baremetal = ironic_client.get_client(
|
||||
1, os_auth_token=token, ironic_url=endpoint,
|
||||
ca_file=self._instance._cli_options.os_cacert)
|
||||
|
||||
return self._baremetal
|
||||
|
||||
@property
|
||||
def orchestration(self):
|
||||
"""Returns an orchestration service client"""
|
||||
|
|
|
@ -21,22 +21,19 @@ import mock
|
|||
|
||||
class TestPlugin(base.TestCase):
|
||||
|
||||
@mock.patch('ironicclient.client.get_client')
|
||||
def test_make_client(self, ironic_get_client):
|
||||
def test_make_client(self):
|
||||
clientmgr = mock.MagicMock()
|
||||
clientmgr._api_version.__getitem__.return_value = '1'
|
||||
clientmgr.get_endpoint_for_service_type.return_value = fakes.AUTH_URL
|
||||
|
||||
client = plugin.make_client(clientmgr)
|
||||
|
||||
# The client should have a baremetal property. Accessing it should
|
||||
# The client should have an orchestration property. Accessing it should
|
||||
# fetch it from the clientmanager:
|
||||
baremetal = client.baremetal
|
||||
orchestration = client.orchestration
|
||||
# The second access should return the same clients:
|
||||
self.assertIs(client.baremetal, baremetal)
|
||||
# The second access should return the same client:
|
||||
self.assertIs(client.orchestration, orchestration)
|
||||
|
||||
# And the functions should only be called per property:
|
||||
self.assertEqual(clientmgr.get_endpoint_for_service_type.call_count, 2)
|
||||
self.assertEqual(clientmgr.auth.get_token.call_count, 2)
|
||||
# And the functions should only be called when the client is created:
|
||||
self.assertEqual(clientmgr.get_endpoint_for_service_type.call_count, 1)
|
||||
self.assertEqual(clientmgr.auth.get_token.call_count, 1)
|
||||
|
|
|
@ -67,22 +67,11 @@ class FakeBaremetalNodeClient(object):
|
|||
for uuid in (sorted(self.states.keys()))]
|
||||
|
||||
|
||||
class FakeClientWrapper(object):
|
||||
|
||||
def __init__(self):
|
||||
self._instance = mock.Mock()
|
||||
self._baremetal = mock.Mock()
|
||||
|
||||
@property
|
||||
def baremetal(self):
|
||||
return self._baremetal
|
||||
|
||||
|
||||
class TestBaremetal(utils.TestCommand):
|
||||
|
||||
def setUp(self):
|
||||
super(TestBaremetal, self).setUp()
|
||||
|
||||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
self.app.client_manager.baremetal = mock.Mock()
|
||||
self.app.client_manager.image = mock.Mock()
|
||||
|
|
|
@ -370,7 +370,7 @@ pxe_ssh,192.168.122.1,root,"KEY2",00:7c:ef:3d:eb:60""")
|
|||
'mac': ['00:0b:d0:69:7e:58']
|
||||
}
|
||||
],
|
||||
client=self.app.client_manager.tripleoclient.baremetal,
|
||||
client=self.app.client_manager.baremetal,
|
||||
keystone_client=None)
|
||||
|
||||
@mock.patch('os_cloud_config.nodes.register_all_nodes', autospec=True)
|
||||
|
@ -405,7 +405,7 @@ pxe_ssh,192.168.122.1,root,"KEY2",00:7c:ef:3d:eb:60""")
|
|||
'mac': ['00:0b:d0:69:7e:58']
|
||||
}
|
||||
],
|
||||
client=self.app.client_manager.tripleoclient.baremetal,
|
||||
client=self.app.client_manager.baremetal,
|
||||
keystone_client=None)
|
||||
|
||||
@mock.patch('os_cloud_config.nodes.register_all_nodes', autospec=True)
|
||||
|
@ -439,7 +439,7 @@ pxe_ssh,192.168.122.1,root,"KEY2",00:7c:ef:3d:eb:60""")
|
|||
'mac': ['00:7c:ef:3d:eb:60']
|
||||
}
|
||||
],
|
||||
client=self.app.client_manager.tripleoclient.baremetal,
|
||||
client=self.app.client_manager.baremetal,
|
||||
keystone_client=None)
|
||||
|
||||
|
||||
|
@ -455,7 +455,7 @@ class TestStartBaremetalIntrospectionBulk(fakes.TestBaremetal):
|
|||
@mock.patch.object(baremetal.inspector_client, 'get_status', autospec=True)
|
||||
@mock.patch.object(baremetal.inspector_client, 'introspect', autospec=True)
|
||||
def test_introspect_bulk_one(self, inspection_mock, get_status_mock):
|
||||
client = self.app.client_manager.tripleoclient.baremetal
|
||||
client = self.app.client_manager.baremetal
|
||||
client.node = fakes.FakeBaremetalNodeClient(
|
||||
states={"ABCDEFGH": "available"},
|
||||
transitions={
|
||||
|
@ -479,7 +479,7 @@ class TestStartBaremetalIntrospectionBulk(fakes.TestBaremetal):
|
|||
@mock.patch.object(baremetal.inspector_client, 'introspect', autospec=True)
|
||||
def test_introspect_bulk_failed(self, introspect_mock, get_status_mock):
|
||||
|
||||
client = self.app.client_manager.tripleoclient.baremetal
|
||||
client = self.app.client_manager.baremetal
|
||||
client.node = fakes.FakeBaremetalNodeClient(
|
||||
states={"ABCDEFGH": "available", "IJKLMNOP": "available"},
|
||||
transitions={
|
||||
|
@ -510,7 +510,7 @@ class TestStartBaremetalIntrospectionBulk(fakes.TestBaremetal):
|
|||
@mock.patch.object(baremetal.inspector_client, 'get_status', autospec=True)
|
||||
@mock.patch.object(baremetal.inspector_client, 'introspect', autospec=True)
|
||||
def test_introspect_bulk(self, introspect_mock, get_status_mock):
|
||||
client = self.app.client_manager.tripleoclient.baremetal
|
||||
client = self.app.client_manager.baremetal
|
||||
client.node = fakes.FakeBaremetalNodeClient(
|
||||
states={
|
||||
"ABC": "available",
|
||||
|
@ -558,7 +558,7 @@ class TestStartBaremetalIntrospectionBulk(fakes.TestBaremetal):
|
|||
@mock.patch.object(baremetal.inspector_client, 'get_status', autospec=True)
|
||||
@mock.patch.object(baremetal.inspector_client, 'introspect', autospec=True)
|
||||
def test_introspect_bulk_timeout(self, introspect_mock, get_status_mock):
|
||||
client = self.app.client_manager.tripleoclient.baremetal
|
||||
client = self.app.client_manager.baremetal
|
||||
client.node = fakes.FakeBaremetalNodeClient(
|
||||
states={
|
||||
"ABC": "available",
|
||||
|
@ -591,7 +591,7 @@ class TestStartBaremetalIntrospectionBulk(fakes.TestBaremetal):
|
|||
@mock.patch.object(baremetal.inspector_client, 'introspect', autospec=True)
|
||||
def test_introspect_bulk_transition_fails(self, introspect_mock,
|
||||
get_status_mock):
|
||||
client = self.app.client_manager.tripleoclient.baremetal
|
||||
client = self.app.client_manager.baremetal
|
||||
client.node = fakes.FakeBaremetalNodeClient(
|
||||
states={
|
||||
"ABC": "available",
|
||||
|
@ -636,7 +636,7 @@ class TestStatusBaremetalIntrospectionBulk(fakes.TestBaremetal):
|
|||
@mock.patch.object(baremetal.inspector_client, 'get_status', autospec=True)
|
||||
def test_status_bulk_one(self, get_status_mock):
|
||||
|
||||
client = self.app.client_manager.tripleoclient.baremetal
|
||||
client = self.app.client_manager.baremetal
|
||||
client.node.list.return_value = [
|
||||
mock.Mock(uuid="ABCDEFGH")
|
||||
]
|
||||
|
@ -658,7 +658,7 @@ class TestStatusBaremetalIntrospectionBulk(fakes.TestBaremetal):
|
|||
@mock.patch.object(baremetal.inspector_client, 'get_status', autospec=True)
|
||||
def test_status_bulk(self, get_status_mock):
|
||||
|
||||
client = self.app.client_manager.tripleoclient.baremetal
|
||||
client = self.app.client_manager.baremetal
|
||||
client.node.list.return_value = [
|
||||
mock.Mock(uuid="ABCDEFGH"),
|
||||
mock.Mock(uuid="IJKLMNOP"),
|
||||
|
@ -719,7 +719,7 @@ class TestConfigureReadyState(fakes.TestBaremetal):
|
|||
nodes = [mock.Mock(uuid='foo', driver='drac'),
|
||||
mock.Mock(uuid='bar', driver='ilo'),
|
||||
mock.Mock(uuid='baz', driver='drac')]
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
bm_client.node.list.return_value = nodes
|
||||
|
||||
argslist = ['--delete-existing-raid-volumes']
|
||||
|
@ -761,7 +761,7 @@ class TestConfigureReadyState(fakes.TestBaremetal):
|
|||
nodes = [mock.Mock(uuid='foo', driver='drac'),
|
||||
mock.Mock(uuid='bar', driver='ilo'),
|
||||
mock.Mock(uuid='baz', driver='drac')]
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
bm_client.node.list.return_value = nodes
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, [], [])
|
||||
|
@ -784,7 +784,7 @@ class TestConfigureReadyState(fakes.TestBaremetal):
|
|||
return_value=0)
|
||||
def test__configure_bios(self, mock_sleep_time):
|
||||
nodes = [mock.Mock(uuid='foo')]
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
self.cmd.bm_client = bm_client
|
||||
|
||||
self.cmd._configure_bios(nodes)
|
||||
|
@ -797,7 +797,7 @@ class TestConfigureReadyState(fakes.TestBaremetal):
|
|||
return_value=0)
|
||||
def test__configure_root_raid_volumes(self, mock_sleep_time):
|
||||
nodes = [mock.Mock(uuid='foo')]
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
self.cmd.bm_client = bm_client
|
||||
|
||||
self.cmd._configure_root_raid_volumes(nodes)
|
||||
|
@ -813,7 +813,7 @@ class TestConfigureReadyState(fakes.TestBaremetal):
|
|||
return_value=0)
|
||||
def test__configure_nonroot_raid_volumes(self, mock_sleep_time):
|
||||
nodes = [mock.Mock(uuid='foo')]
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
self.cmd.bm_client = bm_client
|
||||
|
||||
self.cmd._configure_nonroot_raid_volumes(nodes)
|
||||
|
@ -829,7 +829,7 @@ class TestConfigureReadyState(fakes.TestBaremetal):
|
|||
return_value=0)
|
||||
def test__wait_for_drac_config_jobs(self, mock_sleep_time):
|
||||
nodes = [mock.Mock(uuid='foo')]
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
bm_client.node.vendor_passthru.side_effect = [
|
||||
mock.Mock(unfinished_jobs={'percent_complete': '34',
|
||||
'id': 'JID_343938731947',
|
||||
|
@ -850,7 +850,7 @@ class TestConfigureReadyState(fakes.TestBaremetal):
|
|||
return_value=0)
|
||||
def test__wait_for_drac_config_jobs_times_out(self, mock_sleep_time):
|
||||
nodes = [mock.Mock(uuid='foo')]
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
bm_client.node.vendor_passthru.return_value = mock.Mock(
|
||||
unfinished_jobs={'percent_complete': '34',
|
||||
'id': 'JID_343938731947',
|
||||
|
@ -867,7 +867,7 @@ class TestConfigureReadyState(fakes.TestBaremetal):
|
|||
def test__delete_raid_volumes(self, mock_sleep_time):
|
||||
node_with_raid_volume = mock.Mock(uuid='foo')
|
||||
nodes = [node_with_raid_volume, mock.Mock(uuid='bar')]
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
bm_client.node.vendor_passthru.side_effect = [
|
||||
mock.Mock(virtual_disks=[
|
||||
{'controller': 'RAID.Integrated.1-1',
|
||||
|
@ -896,7 +896,7 @@ class TestConfigureReadyState(fakes.TestBaremetal):
|
|||
|
||||
def test__change_power_state(self):
|
||||
nodes = [mock.Mock(uuid='foo')]
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
self.cmd.bm_client = bm_client
|
||||
|
||||
self.cmd._change_power_state(nodes, 'reboot')
|
||||
|
@ -909,7 +909,7 @@ class TestConfigureReadyState(fakes.TestBaremetal):
|
|||
def test__run_introspection(self, mock_wait_for_node_introspection,
|
||||
mock_introspect):
|
||||
nodes = [mock.Mock(uuid='foo')]
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
self.cmd.bm_client = bm_client
|
||||
self.cmd.inspector_url = None
|
||||
|
||||
|
@ -933,7 +933,7 @@ class TestConfigureBaremetalBoot(fakes.TestBaremetal):
|
|||
def test_configure_boot(self, find_resource_mock):
|
||||
|
||||
find_resource_mock.return_value = mock.Mock(id="IDIDID")
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
bm_client.node.list.return_value = [
|
||||
mock.Mock(uuid="ABCDEFGH"),
|
||||
mock.Mock(uuid="IJKLMNOP"),
|
||||
|
@ -981,7 +981,7 @@ class TestConfigureBaremetalBoot(fakes.TestBaremetal):
|
|||
def test_configure_boot_with_suffix(self, find_resource_mock):
|
||||
|
||||
find_resource_mock.return_value = mock.Mock(id="IDIDID")
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
bm_client.node.list.return_value = [
|
||||
mock.Mock(uuid="ABCDEFGH"),
|
||||
mock.Mock(uuid="IJKLMNOP"),
|
||||
|
@ -1037,7 +1037,7 @@ class TestConfigureBaremetalBoot(fakes.TestBaremetal):
|
|||
def test_configure_boot_in_transition(self, _, find_resource_mock):
|
||||
find_resource_mock.return_value = mock.Mock(id="IDIDID")
|
||||
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
bm_client.node.list.return_value = [mock.Mock(uuid="ABCDEFGH",
|
||||
power_state=None),
|
||||
]
|
||||
|
@ -1065,7 +1065,7 @@ class TestConfigureBaremetalBoot(fakes.TestBaremetal):
|
|||
def test_configure_boot_timeout(self, _, find_resource_mock):
|
||||
find_resource_mock.return_value = mock.Mock(id="IDIDID")
|
||||
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
bm_client.node.list.return_value = [mock.Mock(uuid="ABCDEFGH",
|
||||
power_state=None),
|
||||
]
|
||||
|
@ -1080,7 +1080,7 @@ class TestConfigureBaremetalBoot(fakes.TestBaremetal):
|
|||
def test_configure_boot_skip_maintenance(self, find_resource_mock):
|
||||
|
||||
find_resource_mock.return_value = mock.Mock(id="IDIDID")
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
bm_client.node.list.return_value = [
|
||||
mock.Mock(uuid="ABCDEFGH", maintenance=False),
|
||||
]
|
||||
|
@ -1099,7 +1099,7 @@ class TestConfigureBaremetalBoot(fakes.TestBaremetal):
|
|||
def test_configure_boot_existing_properties(self, find_resource_mock):
|
||||
|
||||
find_resource_mock.return_value = mock.Mock(id="IDIDID")
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
bm_client.node.list.return_value = [
|
||||
mock.Mock(uuid="ABCDEFGH"),
|
||||
mock.Mock(uuid="IJKLMNOP"),
|
||||
|
@ -1180,7 +1180,7 @@ class TestShowNodeCapabilities(fakes.TestBaremetal):
|
|||
|
||||
def test_success(self):
|
||||
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
|
||||
bm_client.node.list.return_value = [
|
||||
mock.Mock(uuid='UUID1'),
|
||||
|
|
|
@ -48,16 +48,11 @@ class FakeClientWrapper(object):
|
|||
def __init__(self):
|
||||
self._instance = mock.Mock()
|
||||
self._orchestration = mock.Mock()
|
||||
self._baremetal = mock.Mock()
|
||||
|
||||
@property
|
||||
def orchestration(self):
|
||||
return self._orchestration
|
||||
|
||||
@property
|
||||
def baremetal(self):
|
||||
return self._baremetal
|
||||
|
||||
|
||||
class TestDeployOvercloud(utils.TestCommand):
|
||||
|
||||
|
@ -66,6 +61,7 @@ class TestDeployOvercloud(utils.TestCommand):
|
|||
|
||||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
self.app.client_manager.baremetal = mock.Mock()
|
||||
self.app.client_manager.network = mock.Mock()
|
||||
self.app.client_manager.compute = mock.Mock()
|
||||
self.app.client_manager.identity = mock.Mock()
|
||||
|
|
|
@ -136,7 +136,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
baremetal = clients.tripleoclient.baremetal
|
||||
baremetal = clients.baremetal
|
||||
baremetal.node.list.return_value = range(10)
|
||||
|
||||
expected_parameters = {
|
||||
|
@ -298,7 +298,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
baremetal = clients.tripleoclient.baremetal
|
||||
baremetal = clients.baremetal
|
||||
baremetal.node.list.return_value = range(10)
|
||||
|
||||
expected_parameters = {
|
||||
|
@ -463,7 +463,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
baremetal = clients.tripleoclient.baremetal
|
||||
baremetal = clients.baremetal
|
||||
baremetal.node.list.return_value = range(10)
|
||||
|
||||
with mock.patch('tempfile.mkstemp') as mkstemp:
|
||||
|
@ -715,7 +715,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
baremetal = clients.tripleoclient.baremetal
|
||||
baremetal = clients.baremetal
|
||||
baremetal.node.list.return_value = range(10)
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
|
|
@ -36,7 +36,7 @@ class TestDeployValidators(fakes.TestDeployOvercloud):
|
|||
def __init__(self, uuid):
|
||||
self.uuid = uuid
|
||||
|
||||
bm_client = fakes.FakeClientWrapper().baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
mock_node = mock.Mock()
|
||||
bm_client.attach_mock(mock_node, 'node')
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ class TestMatchProfiles(test_plugin.TestPluginV1):
|
|||
super(TestMatchProfiles, self).setUp()
|
||||
self.cmd = overcloud_profiles.MatchProfiles(self.app, None)
|
||||
self.app.client_manager.tripleoclient = mock.Mock()
|
||||
self.app.client_manager.baremetal = mock.Mock()
|
||||
self.app.client_manager.compute = mock.Mock()
|
||||
self.flavors = [
|
||||
test_utils.FakeFlavor('compute'),
|
||||
|
@ -49,7 +50,7 @@ class TestMatchProfiles(test_plugin.TestPluginV1):
|
|||
self.cmd.take_action(parsed_args)
|
||||
|
||||
mock_assign.assert_called_once_with(
|
||||
self.app.client_manager.tripleoclient.baremetal,
|
||||
self.app.client_manager.baremetal,
|
||||
{'compute': (self.flavors[0], 3),
|
||||
'control': (self.flavors[1], 1)},
|
||||
assign_profiles=True, dry_run=False)
|
||||
|
@ -69,7 +70,7 @@ class TestMatchProfiles(test_plugin.TestPluginV1):
|
|||
self.cmd.take_action, parsed_args)
|
||||
|
||||
mock_assign.assert_called_once_with(
|
||||
self.app.client_manager.tripleoclient.baremetal,
|
||||
self.app.client_manager.baremetal,
|
||||
{'compute': (self.flavors[0], 3),
|
||||
'control': (self.flavors[1], 1)},
|
||||
assign_profiles=True, dry_run=False)
|
||||
|
@ -89,7 +90,7 @@ class TestMatchProfiles(test_plugin.TestPluginV1):
|
|||
self.cmd.take_action(parsed_args)
|
||||
|
||||
mock_assign.assert_called_once_with(
|
||||
self.app.client_manager.tripleoclient.baremetal,
|
||||
self.app.client_manager.baremetal,
|
||||
{'compute': (self.flavors[0], 3),
|
||||
'control': (self.flavors[1], 1)},
|
||||
assign_profiles=True, dry_run=True)
|
||||
|
@ -100,6 +101,7 @@ class TestListProfiles(test_plugin.TestPluginV1):
|
|||
super(TestListProfiles, self).setUp()
|
||||
self.cmd = overcloud_profiles.ListProfiles(self.app, None)
|
||||
self.app.client_manager.tripleoclient = mock.Mock()
|
||||
self.app.client_manager.baremetal = mock.Mock()
|
||||
self.nodes = [
|
||||
mock.Mock(uuid='uuid1', provision_state='active',
|
||||
properties={}),
|
||||
|
@ -112,7 +114,7 @@ class TestListProfiles(test_plugin.TestPluginV1):
|
|||
properties={'capabilities': 'profile:compute,'
|
||||
'compute_profile:0'}),
|
||||
]
|
||||
self.bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
self.bm_client = self.app.client_manager.baremetal
|
||||
self.bm_client.node.list.return_value = self.nodes
|
||||
|
||||
def test_list(self):
|
||||
|
|
|
@ -177,7 +177,7 @@ class ImportBaremetal(command.Command):
|
|||
nodes.register_all_nodes(
|
||||
parsed_args.service_host,
|
||||
nodes_json,
|
||||
client=self.app.client_manager.tripleoclient.baremetal,
|
||||
client=self.app.client_manager.baremetal,
|
||||
keystone_client=self.app.client_manager.identity)
|
||||
|
||||
|
||||
|
@ -205,7 +205,7 @@ class StartBaremetalIntrospectionBulk(IntrospectionParser, command.Command):
|
|||
def take_action(self, parsed_args):
|
||||
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
client = self.app.client_manager.tripleoclient.baremetal
|
||||
client = self.app.client_manager.baremetal
|
||||
|
||||
auth_token = self.app.client_manager.auth_ref.auth_token
|
||||
node_uuids = []
|
||||
|
@ -274,7 +274,7 @@ class StatusBaremetalIntrospectionBulk(IntrospectionParser, lister.Lister):
|
|||
def take_action(self, parsed_args):
|
||||
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
client = self.app.client_manager.tripleoclient.baremetal
|
||||
client = self.app.client_manager.baremetal
|
||||
auth_token = self.app.client_manager.auth_ref.auth_token
|
||||
|
||||
statuses = []
|
||||
|
@ -421,8 +421,7 @@ class ConfigureReadyState(IntrospectionParser, command.Command):
|
|||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
|
||||
self.bm_client = (
|
||||
self.app.client_manager.tripleoclient.baremetal)
|
||||
self.bm_client = self.app.client_manager.baremetal
|
||||
self.inspector_url = parsed_args.inspector_url
|
||||
drac_nodes = [node for node in self.bm_client.node.list(detail=True)
|
||||
if 'drac' in node.driver]
|
||||
|
@ -466,7 +465,7 @@ class ConfigureBaremetalBoot(command.Command):
|
|||
def take_action(self, parsed_args):
|
||||
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
|
||||
image_client = self.app.client_manager.image
|
||||
|
||||
|
@ -549,7 +548,7 @@ class ShowNodeCapabilities(lister.Lister):
|
|||
log = logging.getLogger(__name__ + ".ShowNodeProfile")
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
rows = []
|
||||
for node in bm_client.node.list():
|
||||
node_detail = bm_client.node.get(node.uuid)
|
||||
|
|
|
@ -329,7 +329,7 @@ class DeployOvercloud(command.Command):
|
|||
parsed_args, network_client, stack)
|
||||
|
||||
utils.check_nodes_count(
|
||||
self.app.client_manager.tripleoclient.baremetal,
|
||||
self.app.client_manager.baremetal,
|
||||
stack,
|
||||
parameters,
|
||||
{
|
||||
|
@ -539,7 +539,7 @@ class DeployOvercloud(command.Command):
|
|||
self.predeploy_warnings = 0
|
||||
self.log.debug("Starting _pre_verify_capabilities")
|
||||
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
|
||||
self._check_boot_images()
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class MatchProfiles(command.Command):
|
|||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
bm_client = self.app.client_manager.tripleoclient.baremetal
|
||||
bm_client = self.app.client_manager.baremetal
|
||||
|
||||
flavors = self._collect_flavors(parsed_args)
|
||||
|
||||
|
@ -93,7 +93,7 @@ class ListProfiles(lister.Lister):
|
|||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
client = self.app.client_manager.tripleoclient.baremetal
|
||||
client = self.app.client_manager.baremetal
|
||||
|
||||
result = []
|
||||
|
||||
|
|
Loading…
Reference in New Issue