From ed47191ed88c4e725603c78f60c0d282f5f44c6f Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Tue, 1 Jun 2021 14:59:31 +0200 Subject: [bas-python] Support multiple urls --- modules.d/bas-python/scripts/collect_hw_info_json.py | 9 +++++---- 1 file 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='') parser.add_argument('-s', '--slot', action='store', help='') @@ -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__": -- cgit v1.2.3-55-g7522