/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-ctl

  • Committer: Teddy Hogeborn
  • Date: 2016-03-05 21:46:00 UTC
  • Revision ID: teddy@recompile.se-20160305214600-2d7peg8qb5xhpi64
Fix incorrect documentation of minor limitation

* mandos-monitor.xml (BUGS): The name which is hard-coded is the D-Bus
                             *bus* name, not the service name.  Fix
                             the documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
import os
40
40
import collections
41
41
import doctest
42
 
import json
43
42
 
44
43
import dbus
45
44
 
73
72
server_path = "/"
74
73
server_interface = domain + ".Mandos"
75
74
client_interface = domain + ".Mandos.Client"
76
 
version = "1.7.10"
 
75
version = "1.7.3"
77
76
 
78
77
 
79
78
try:
281
280
                        help="Select all clients")
282
281
    parser.add_argument("-v", "--verbose", action="store_true",
283
282
                        help="Print all fields")
284
 
    parser.add_argument("-j", "--dump-json", action="store_true",
285
 
                        help="Dump client data in JSON format")
286
283
    parser.add_argument("-e", "--enable", action="store_true",
287
284
                        help="Enable client")
288
285
    parser.add_argument("-d", "--disable", action="store_true",
331
328
    if has_actions(options) and not (options.client or options.all):
332
329
        parser.error("Options require clients names or --all.")
333
330
    if options.verbose and has_actions(options):
334
 
        parser.error("--verbose can only be used alone.")
335
 
    if options.dump_json and (options.verbose or has_actions(options)):
336
 
        parser.error("--dump-json can only be used alone.")
 
331
        parser.error("--verbose can only be used alone or with"
 
332
                     " --all.")
337
333
    if options.all and not has_actions(options):
338
334
        parser.error("--all requires an action.")
339
 
    
 
335
 
340
336
    if options.check:
341
337
        fail_count, test_count = doctest.testmod()
342
338
        sys.exit(os.EX_OK if fail_count == 0 else 1)
393
389
                sys.exit(1)
394
390
    
395
391
    if not has_actions(options) and clients:
396
 
        if options.verbose or options.dump_json:
 
392
        if options.verbose:
397
393
            keywords = ("Name", "Enabled", "Timeout", "LastCheckedOK",
398
394
                        "Created", "Interval", "Host", "Fingerprint",
399
395
                        "CheckerRunning", "LastEnabled",
404
400
        else:
405
401
            keywords = defaultkeywords
406
402
        
407
 
        if options.dump_json:
408
 
            json.dump({client["Name"]: {key: client[key]
409
 
                                        for key in keywords }
410
 
                       for client in clients.values() },
411
 
                      fp = sys.stdout, indent = 4,
412
 
                      separators = (',', ': '))
413
 
            print()
414
 
        else:
415
 
            print_clients(clients.values(), keywords)
 
403
        print_clients(clients.values(), keywords)
416
404
    else:
417
405
        # Process each client in the list by all selected options
418
406
        for client in clients: