diff options
author | Jannik Schönartz | 2021-06-01 14:59:31 +0200 |
---|---|---|
committer | Jannik Schönartz | 2021-06-01 14:59:31 +0200 |
commit | ed47191ed88c4e725603c78f60c0d282f5f44c6f (patch) | |
tree | d3890e2d0a2d9c221dbac96df4b1ec208f34dde7 | |
parent | [bas-python] Add clientname as parameter (diff) | |
download | systemd-init-ed47191ed88c4e725603c78f60c0d282f5f44c6f.tar.gz systemd-init-ed47191ed88c4e725603c78f60c0d282f5f44c6f.tar.xz systemd-init-ed47191ed88c4e725603c78f60c0d282f5f44c6f.zip |
[bas-python] Support multiple urls
-rwxr-xr-x | modules.d/bas-python/scripts/collect_hw_info_json.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/modules.d/bas-python/scripts/collect_hw_info_json.py b/modules.d/bas-python/scripts/collect_hw_info_json.py index 8695ff64..4d874791 100755 --- a/modules.d/bas-python/scripts/collect_hw_info_json.py +++ b/modules.d/bas-python/scripts/collect_hw_info_json.py @@ -213,7 +213,7 @@ def main(): # Create and parse arguments parser = argparse.ArgumentParser(description='Collects hardware data from different tools and returns it as json.') parser.add_argument('-d', '--debug', action='store_true', help='Prints all STDERR messages. (Non critical included)') - parser.add_argument('-u', '--url', action='store', help='If given, a post request with the generated JSON is sent to the given URL') + parser.add_argument('-u', '--url', action='append', help='If given, a post request with the generated JSON is sent to the given URL') parser.add_argument('-p', '--print', action='store_true', help='Prints the generated JSON') parser.add_argument('-r', '--rack', action='store', help='<rack>') parser.add_argument('-s', '--slot', action='store', help='<slot>') @@ -241,11 +241,12 @@ def main(): _collecthw['name'] = args.name collecthw_json = json.dumps(_collecthw) - if (args.url): - send_post(args.url, _collecthw) + if args.url: + for url in args.url: + send_post(args.url, _collecthw) # Print out the final json - if (args.print): + if args.print: print(json.dumps(_collecthw)) if __name__ == "__main__": |