2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 03:19:48 +00:00

Merge remote-tracking branch 'lenovo/master'

This commit is contained in:
Jarrod Johnson 2023-04-07 13:53:44 -04:00
commit 25b0f45e6f

View File

@ -237,6 +237,7 @@ if __name__ == '__main__':
allok = True
uuidok = False
macok = False
valid_nodes = [node['item']['href'][:-1] for node in c.read('/nodes/')] #get all valiv nodes
for rsp in sess.read(f'/nodes/{args.node}/attributes/all'):
if rsp.get('errorcode', None) == 404:
emprint(f'There is no node named "{args.node}"')
@ -259,6 +260,14 @@ if __name__ == '__main__':
mac = rsp[key].get('value', None)
if mac:
macok = True
#adding new code to check if the response is something like net.<something>switch
for key in rsp:
if key.startswith('net.')and key.endswith('switch'):
switch_value = rsp[key].get('value',None)
if switch_value in valid_nodes:
print(f'{switch_value} is valid.')
else:
emprint(f'{switch_value} is not valid.')
if not uuidok and not macok:
allok = False
emprint(f'{args.node} does not have a uuid or mac address defined in id.uuid or net.*hwaddr, deployment will not work')