2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 11:01:09 +00:00

Add attributes for profiles to report state

Profiles may want to report things
like success and error
This commit is contained in:
Jarrod Johnson 2023-01-13 12:54:21 -05:00
parent d644d34b60
commit 51e53405d8
3 changed files with 20 additions and 1 deletions

View File

@ -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'] = ''

View File

@ -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 '

View File

@ -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':