From a93b3aa3d7745275bbc336d7c85880e561f559de Mon Sep 17 00:00:00 2001 From: Stephen Date: Fri, 19 Apr 2024 15:26:02 +0200 Subject: [PATCH 1/2] added search argument --- hah.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hah.py b/hah.py index f7caa94..35f3680 100755 --- a/hah.py +++ b/hah.py @@ -192,6 +192,9 @@ def send_notification(notifier, server, send_payload): help='debug mode') parser.add_argument('--send-payload', action='store_true', help='send server data as JSON payload') + parser.add_argument('--search', nargs=1, required=False, type=str, + help='search for specific server by description') + cli_args = parser.parse_args() if not cli_args.test_mode: @@ -248,10 +251,16 @@ def send_notification(notifier, server, send_payload): ipv4_matches = server.sp_ipv4 if cli_args.ipv4 else True inic_matches = server.sp_inic if cli_args.inic else True + if cli_args.search: + search_matches = cli_args.search[0] in server.cpu_description + else: + search_matches = True + + if price_matches and disk_count_matches and disk_size_matches and disk_min_size_matches and \ disk_quick_matches and hw_raid_matches and red_psu_matches and cpu_count_matches and \ ram_matches and ecc_matches and gpu_matches and ipv4_matches and inic_matches and \ - datacenter_matches: + datacenter_matches and search_matches: print(server.get_header()) if not cli_args.test_mode: From d812997e006f9508332ba7d55aa40b571ff6bff8 Mon Sep 17 00:00:00 2001 From: Stephen Date: Fri, 19 Apr 2024 15:27:29 +0200 Subject: [PATCH 2/2] made help a bit more clear --- hah.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hah.py b/hah.py index 35f3680..420d91c 100755 --- a/hah.py +++ b/hah.py @@ -193,7 +193,7 @@ def send_notification(notifier, server, send_payload): parser.add_argument('--send-payload', action='store_true', help='send server data as JSON payload') parser.add_argument('--search', nargs=1, required=False, type=str, - help='search for specific server by description') + help='search for specific server by CPU description') cli_args = parser.parse_args()