Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added search argument #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion hah.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 CPU description')

cli_args = parser.parse_args()

if not cli_args.test_mode:
Expand Down Expand Up @@ -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:
Expand Down