Merge "Remove separate call to provide workflow"

This commit is contained in:
Jenkins 2017-01-05 14:48:19 +00:00 committed by Gerrit Code Review
commit 83d6d177e1
2 changed files with 9 additions and 44 deletions

View File

@ -344,6 +344,8 @@ pxe_ssh,192.168.122.2,stack,"KEY2",00:0b:d0:69:7e:58""")
],
}, {
"status": "SUCCESS"
}, {
"status": "SUCCESS"
}]
self.workflow = self.app.client_manager.workflow_engine
@ -375,22 +377,14 @@ pxe_ssh,192.168.122.2,stack,"KEY2",00:0b:d0:69:7e:58""")
'nodes_json': self.nodes_list,
'queue_name': 'UUID4',
'ramdisk_name': ramdisk_name,
'instance_boot_option': 'local' if local else 'netboot'
'instance_boot_option': 'local' if local else 'netboot',
'initial_state': 'available',
}
)]
if provide:
call_list.append(mock.call(
'tripleo.baremetal.v1.provide', workflow_input={
'node_uuids': ['MOCK_NODE_UUID', ],
'queue_name': 'UUID4'
}
))
self.workflow.executions.create.assert_has_calls(call_list)
self.assertEqual(self.workflow.executions.create.call_count,
2 if provide else 1)
self.assertEqual(self.workflow.executions.create.call_count, 1)
def test_json_import(self):
@ -407,26 +401,6 @@ pxe_ssh,192.168.122.2,stack,"KEY2",00:0b:d0:69:7e:58""")
self._check_workflow_call()
def test_json_import_initial_state_enroll(self):
arglist = [
self.json_file.name,
'--json',
'-s', 'http://localhost',
'--initial-state', 'enroll'
]
verifylist = [
('csv', False),
('json', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args)
self._check_workflow_call(provide=False)
self.assertEqual([], self.baremetal.node.updates)
def test_available_does_not_require_api_1_11(self):
arglist = [self.json_file.name, '--json', '-s', 'http://localhost']

View File

@ -145,7 +145,7 @@ class ImportBaremetal(command.Command):
parser.add_argument('file_in', type=argparse.FileType('r'))
parser.add_argument(
'--initial-state',
choices=['enroll', 'available'],
choices=['enroll', 'manageable', 'available'],
default='available',
help=_('Provision state for newly-enrolled nodes.')
)
@ -181,25 +181,16 @@ class ImportBaremetal(command.Command):
deploy_kernel = parsed_args.deploy_kernel
deploy_ramdisk = parsed_args.deploy_ramdisk
nodes = baremetal.register_or_update(
baremetal.register_or_update(
self.app.client_manager,
nodes_json=nodes_config,
queue_name=queue_name,
kernel_name=deploy_kernel,
ramdisk_name=deploy_ramdisk,
instance_boot_option=parsed_args.instance_boot_option
instance_boot_option=parsed_args.instance_boot_option,
initial_state=parsed_args.initial_state,
)
if parsed_args.initial_state == "available":
# NOTE(dtantsur): newly enrolled nodes state is reported as
# "enroll" from the workflow even though it's actually "manageable"
# because the node list is built before "manage" action is run.
node_uuids = [node['uuid'] for node in nodes
if node['provision_state'] in {'manageable',
'enroll'}]
baremetal.provide(self.app.client_manager, node_uuids=node_uuids,
queue_name=queue_name)
class StartBaremetalIntrospectionBulk(command.Command):
"""Start bulk introspection on all baremetal nodes (Deprecated).