diff --git a/confluent_client/bin/nodedeploy b/confluent_client/bin/nodedeploy index 1dae7ac9..2e329a50 100755 --- a/confluent_client/bin/nodedeploy +++ b/confluent_client/bin/nodedeploy @@ -49,7 +49,7 @@ def armonce(nr, cli): def setpending(nr, profile, cli): - args = {'deployment.pendingprofile': profile} + args = {'deployment.pendingprofile': profile, 'deployment.state': '', 'deployment.state_detail': ''} if not profile.startswith('genesis-'): args['deployment.stagedprofile'] = '' args['deployment.profile'] = '' diff --git a/confluent_server/confluent/config/attributes.py b/confluent_server/confluent/config/attributes.py index be5c5dcc..50f5492b 100644 --- a/confluent_server/confluent/config/attributes.py +++ b/confluent_server/confluent/config/attributes.py @@ -233,6 +233,12 @@ node = { 'a stateless profile would be both after first boot.') }, + 'deployment.state': { + 'description': ('Profiles may push more specific state, for example, it may set the state to "failed" or "succeded"'), + }, + 'deployment.state_detail': { + 'description': ('Detailed state information as reported by an OS profile, when available'), + }, 'deployment.useinsecureprotocols': { 'description': ('What phase(s) of boot are permitted to use insecure protocols ' '(TFTP and HTTP without TLS. By default, only HTTPS is used. However ' diff --git a/confluent_server/confluent/selfservice.py b/confluent_server/confluent/selfservice.py index 574844f5..29b7fa01 100644 --- a/confluent_server/confluent/selfservice.py +++ b/confluent_server/confluent/selfservice.py @@ -420,6 +420,19 @@ def handle_request(env, start_response): yield 'complete' elif env['PATH_INFO'] == '/self/updatestatus' and reqbody: update = yaml.safe_load(reqbody) + statusstr = update.get('state', None) + statusdetail = update.get('state_detail', None) + didstateupdate = False + if statusstr: + cfg.set_node_attributes({nodename: {'deployment.state': statusstr}}) + didstateupdate = True + if statusdetail: + cfg.set_node_attributes({nodename: {'deployment.state_detail': statusdetail}}) + didstateupdate = True + if 'status' not in update and didstateupdate: + start_response('200 Ok', ()) + yield 'Accepted' + return if update['status'] == 'staged': targattr = 'deployment.stagedprofile' elif update['status'] == 'complete':