Client code to do node import with ansible instead of mistral
This moves the node import into ansible. Story: 2007126 Task: 38183 Change-Id: I7889228333dfc503529770d5cf06a35f39432f18 Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
parent
4e5a4af642
commit
72cfa4f653
@ -163,6 +163,7 @@ class FakePlaybookExecution(utils.TestCommand):
|
||||
def setUp(self, ansible_mock=True):
|
||||
super(FakePlaybookExecution, self).setUp()
|
||||
|
||||
self.app.options = FakeOptions()
|
||||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||
self.app.client_manager.baremetal = mock.Mock()
|
||||
compute = self.app.client_manager.compute = mock.Mock()
|
||||
|
@ -19,6 +19,7 @@ import fixtures
|
||||
import json
|
||||
import mock
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from osc_lib import exceptions as oscexc
|
||||
@ -75,8 +76,6 @@ class TestDeleteNode(fakes.TestDeleteNode):
|
||||
self.addCleanup(wait_stack.stop)
|
||||
self.app.client_manager.compute.servers.get.return_value = None
|
||||
|
||||
# TODO(someone): This test does not pass with autospec=True, it should
|
||||
# probably be fixed so that it can pass with that.
|
||||
@mock.patch('tripleoclient.utils.run_ansible_playbook',
|
||||
autospec=True)
|
||||
def test_node_delete(self, mock_playbook):
|
||||
@ -247,9 +246,11 @@ class TestDeleteNode(fakes.TestDeleteNode):
|
||||
)
|
||||
])
|
||||
|
||||
@mock.patch('tripleoclient.utils.run_ansible_playbook',
|
||||
autospec=True)
|
||||
@mock.patch('tripleoclient.workflows.baremetal.expand_roles',
|
||||
autospec=True)
|
||||
def test_nodes_to_delete(self, mock_expand_roles):
|
||||
def test_nodes_to_delete(self, mock_expand_roles, mock_playbook):
|
||||
bm_yaml = [{
|
||||
'name': 'Compute',
|
||||
'count': 5,
|
||||
@ -615,7 +616,19 @@ class TestImportNodeMultiArch(fakes.TestOvercloudNode):
|
||||
|
||||
with mock.patch('tripleoclient.utils.run_ansible_playbook',
|
||||
autospec=True):
|
||||
self.cmd.take_action(parsed_args)
|
||||
file_return_nodes = [
|
||||
{
|
||||
'uuid': 'MOCK_NODE_UUID'
|
||||
}
|
||||
]
|
||||
mock_open = mock.mock_open(read_data=json.dumps(file_return_nodes))
|
||||
# TODO(cloudnull): Remove this when py27 is dropped
|
||||
if sys.version_info >= (3, 0):
|
||||
mock_open_path = 'builtins.open'
|
||||
else:
|
||||
mock_open_path = 'tripleoclient.v1.overcloud_node.open'
|
||||
with mock.patch(mock_open_path, mock_open):
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
nodes_list = copy.deepcopy(self.nodes_list)
|
||||
if not no_deploy_image:
|
||||
|
@ -32,7 +32,6 @@ class FakePluginV1Client(object):
|
||||
class TestPluginV1(base.TestCommand):
|
||||
def setUp(self):
|
||||
super(TestPluginV1, self).setUp()
|
||||
|
||||
self.app.client_manager.tripleoclient = FakePluginV1Client(
|
||||
endpoint=fakes.AUTH_URL,
|
||||
token=fakes.AUTH_TOKEN,
|
||||
|
@ -64,8 +64,6 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
self.orc.stacks.create = mock.MagicMock(
|
||||
return_value={'stack': {'id': 'foo'}})
|
||||
|
||||
self.ansible_playbook_cmd = "ansible-playbook"
|
||||
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy._is_undercloud_deploy')
|
||||
@mock.patch('tripleoclient.utils.check_hostname')
|
||||
def test_run_preflight_checks(self, mock_check_hostname, mock_uc):
|
||||
|
Loading…
Reference in New Issue
Block a user