Browse Source

Remove separate call to provide workflow

The provide workflow is now called directly from the register_or_update
workflow. It should no longer be called from the client.

Change-Id: I127061eff8763c159f380dd47d3a06813184faba
Depends-On: I40f0b27a0f38447372181f9fae6a31e57dbd79e4
Closes-Bug: #1637474
tags/6.0.0
Brad P. Crochet 3 years ago
parent
commit
4b775db3d4
2 changed files with 9 additions and 44 deletions
  1. +5
    -31
      tripleoclient/tests/v1/baremetal/test_baremetal.py
  2. +4
    -13
      tripleoclient/v1/baremetal.py

+ 5
- 31
tripleoclient/tests/v1/baremetal/test_baremetal.py 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']



+ 4
- 13
tripleoclient/v1/baremetal.py 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).


Loading…
Cancel
Save