Fix: boot actions signaling
- When signaling is false, boot action should be added to database with new result 'Unreported' indicating the boot action result is indeterminate. Closes #87 Change-Id: I505cb61d6ec4aeb752b6c2c08109b59e1f9347f8
This commit is contained in:
parent
8939447669
commit
83f57669fb
@ -81,8 +81,9 @@ class ActionResult(BaseDrydockEnum):
|
||||
Success = 'success'
|
||||
PartialSuccess = 'partial_success'
|
||||
Failure = 'failure'
|
||||
Unreported = 'unreported'
|
||||
|
||||
ALL = (Incomplete, Success, PartialSuccess, Failure)
|
||||
ALL = (Incomplete, Success, PartialSuccess, Failure, Unreported)
|
||||
|
||||
|
||||
class ActionResultField(fields.BaseEnumField):
|
||||
|
@ -550,18 +550,19 @@ class Orchestrator(object):
|
||||
identity_key = os.urandom(32)
|
||||
self.state_manager.post_boot_action_context(
|
||||
nodename, task.get_id(), identity_key)
|
||||
self.logger.debug(
|
||||
"Adding boot action %s for node %s to the database." %
|
||||
(ba.name, nodename))
|
||||
if ba.signaling:
|
||||
self.logger.debug(
|
||||
"Adding boot action %s for node %s to the database." %
|
||||
(ba.name, nodename))
|
||||
action_id = ulid2.generate_binary_ulid()
|
||||
self.state_manager.post_boot_action(
|
||||
nodename, task.get_id(), identity_key, action_id,
|
||||
ba.name)
|
||||
init_status = hd_fields.ActionResult.Incomplete
|
||||
else:
|
||||
init_status = hd_fields.ActionResult.Unreported
|
||||
self.logger.debug(
|
||||
"Boot action %s has disabled signaling." % ba.name)
|
||||
|
||||
"Boot action %s has disabled signaling, marking unreported." % ba.name)
|
||||
action_id = ulid2.generate_binary_ulid()
|
||||
self.state_manager.post_boot_action(
|
||||
nodename, task.get_id(), identity_key, action_id,
|
||||
ba.name, action_status=init_status)
|
||||
return identity_key
|
||||
|
||||
def render_route_domains(self, site_design):
|
||||
|
@ -34,7 +34,21 @@ class TestBootActionSignal(object):
|
||||
|
||||
bootactions = drydock_state.get_boot_actions_for_node('compute01')
|
||||
|
||||
assert len(bootactions) == 1
|
||||
assert len(bootactions) == 2
|
||||
|
||||
# one bootaction should expecting signaling
|
||||
reported_bas = [x
|
||||
for x
|
||||
in bootactions.values()
|
||||
if x.get('action_status') == hd_fields.ActionResult.Incomplete]
|
||||
assert len(reported_bas) == 1
|
||||
|
||||
# one bootaction should not expect signaling
|
||||
unreported_bas = [x
|
||||
for x
|
||||
in bootactions.values()
|
||||
if not x.get('action_status') == hd_fields.ActionResult.Unreported]
|
||||
assert len(unreported_bas) == 1
|
||||
|
||||
design_status, design_data = deckhand_orchestrator.get_effective_site(
|
||||
design_ref=design_ref)
|
||||
|
Loading…
x
Reference in New Issue
Block a user