65
64
"ApprovalDelay": "Approval Delay",
66
65
"ApprovalDuration": "Approval Duration",
67
66
"Checker": "Checker",
68
"ExtendedTimeout": "Extended Timeout",
70
"LastCheckerStatus": "Last Checker Status",
67
"ExtendedTimeout": "Extended Timeout"
72
69
defaultkeywords = ("Name", "Enabled", "Timeout", "LastCheckedOK")
73
70
domain = "se.recompile"
283
280
help="Select all clients")
284
281
parser.add_argument("-v", "--verbose", action="store_true",
285
282
help="Print all fields")
286
parser.add_argument("-j", "--dump-json", action="store_true",
287
help="Dump client data in JSON format")
288
283
parser.add_argument("-e", "--enable", action="store_true",
289
284
help="Enable client")
290
285
parser.add_argument("-d", "--disable", action="store_true",
333
328
if has_actions(options) and not (options.client or options.all):
334
329
parser.error("Options require clients names or --all.")
335
330
if options.verbose and has_actions(options):
336
parser.error("--verbose can only be used alone.")
337
if options.dump_json and (options.verbose or has_actions(options)):
338
parser.error("--dump-json can only be used alone.")
331
parser.error("--verbose can only be used alone or with"
339
333
if options.all and not has_actions(options):
340
334
parser.error("--all requires an action.")
342
336
if options.check:
343
337
fail_count, test_count = doctest.testmod()
344
338
sys.exit(os.EX_OK if fail_count == 0 else 1)
397
391
if not has_actions(options) and clients:
398
if options.verbose or options.dump_json:
399
393
keywords = ("Name", "Enabled", "Timeout", "LastCheckedOK",
400
394
"Created", "Interval", "Host", "Fingerprint",
401
395
"CheckerRunning", "LastEnabled",
402
396
"ApprovalPending", "ApprovedByDefault",
403
397
"LastApprovalRequest", "ApprovalDelay",
404
398
"ApprovalDuration", "Checker",
405
"ExtendedTimeout", "Expires",
408
401
keywords = defaultkeywords
410
if options.dump_json:
411
json.dump({client["Name"]: {key:
413
if isinstance(client[key],
416
for key in keywords }
417
for client in clients.values() },
418
fp = sys.stdout, indent = 4,
419
separators = (',', ': '))
422
print_clients(clients.values(), keywords)
403
print_clients(clients.values(), keywords)
424
405
# Process each client in the list by all selected options
425
406
for client in clients: