From 88c47c9254235a795e7566f2b092bf1970c79ea1 Mon Sep 17 00:00:00 2001 From: erderial <71669104+erderial@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:43:15 +0300 Subject: [PATCH 1/3] added functionality to check for net.*switch added functionality to check for net.*switch --- confluent_server/bin/confluent_selfcheck | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/confluent_server/bin/confluent_selfcheck b/confluent_server/bin/confluent_selfcheck index 6a9d5163..af4e6283 100755 --- a/confluent_server/bin/confluent_selfcheck +++ b/confluent_server/bin/confluent_selfcheck @@ -237,6 +237,7 @@ if __name__ == '__main__': allok = True uuidok = False macok = False + valid_nodes = [node for node in sess.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,15 @@ 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.switch + for key in rsp: + if key.startswith('new.')and key.endswith('switch'): + switch_value = rsp[key].get('value',None) + if switch_value == 'true': + if args.node in valid_nodes: + print(f'{args.node} is a valid node.') + else: + emprint(f'{args.node} is not a valid node') 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') From 13d4c57ee2bb01c1478a6472a3b504fe17447a41 Mon Sep 17 00:00:00 2001 From: erderial <71669104+erderial@users.noreply.github.com> Date: Fri, 31 Mar 2023 19:32:43 +0300 Subject: [PATCH 2/3] changes done as per request --- confluent_server/bin/confluent_selfcheck | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/confluent_server/bin/confluent_selfcheck b/confluent_server/bin/confluent_selfcheck index af4e6283..29b13f25 100755 --- a/confluent_server/bin/confluent_selfcheck +++ b/confluent_server/bin/confluent_selfcheck @@ -237,7 +237,7 @@ if __name__ == '__main__': allok = True uuidok = False macok = False - valid_nodes = [node for node in sess.read('/nodes/')] #get all valiv nodes + 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}"') @@ -262,9 +262,9 @@ if __name__ == '__main__': macok = True #adding new code to check if the response is something like net.switch for key in rsp: - if key.startswith('new.')and key.endswith('switch'): + if key.startswith('net.')and key.endswith('switch'): switch_value = rsp[key].get('value',None) - if switch_value == 'true': + if switch_value in valid_nodes: if args.node in valid_nodes: print(f'{args.node} is a valid node.') else: From 9bb402a1b87a538d35accbb31bb5102f6f541ff2 Mon Sep 17 00:00:00 2001 From: erderial <71669104+erderial@users.noreply.github.com> Date: Mon, 3 Apr 2023 10:27:07 +0300 Subject: [PATCH 3/3] Update confluent_selfcheck --- confluent_server/bin/confluent_selfcheck | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/confluent_server/bin/confluent_selfcheck b/confluent_server/bin/confluent_selfcheck index 29b13f25..b6341b91 100755 --- a/confluent_server/bin/confluent_selfcheck +++ b/confluent_server/bin/confluent_selfcheck @@ -265,10 +265,9 @@ if __name__ == '__main__': if key.startswith('net.')and key.endswith('switch'): switch_value = rsp[key].get('value',None) if switch_value in valid_nodes: - if args.node in valid_nodes: - print(f'{args.node} is a valid node.') - else: - emprint(f'{args.node} is not a valid node') + 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')