mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-21 17:11:58 +00:00
better error handling
This commit is contained in:
parent
945dff09f3
commit
8d726bced9
@ -88,6 +88,7 @@ for rsp in session.read('/noderange/{0}/configuration/management_controller/user
|
||||
for node in databynode:
|
||||
if 'error' in rsp['databynode'][node]:
|
||||
print(node, ':', rsp['databynode'][node]['error'])
|
||||
errorNodes.add(node)
|
||||
continue
|
||||
for user in rsp['databynode'][node]['users']:
|
||||
if user['username'] == username:
|
||||
@ -97,6 +98,10 @@ for rsp in session.read('/noderange/{0}/configuration/management_controller/user
|
||||
uid_dict[user['uid']] = uid_dict[user['uid']] + ',{}'.format(node)
|
||||
break
|
||||
|
||||
if not uid_dict:
|
||||
print("Error: Could not reach target node's bmc user")
|
||||
sys.exit(1)
|
||||
|
||||
for uid in uid_dict:
|
||||
success = session.simple_noderange_command(uid_dict[uid], 'configuration/management_controller/users/{0}'.format(uid), new_password, key='password', errnodes=errorNodes) # = 0 if successful
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user