/mandos/release

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

« back to all changes in this revision

Viewing changes to mandos-ctl

  • Committer: Teddy Hogeborn
  • Date: 2019-03-07 19:15:13 UTC
  • mto: (237.7.594 trunk)
  • mto: This revision was merged to the branch mainline in revision 382.
  • Revision ID: teddy@recompile.se-20190307191513-xr13bq6bhfkzaiud
mandos-ctl: Refactor

* mandos-ctl (has_action): Move into main(), where is it being used.

Show diffs side-by-side

added added

removed removed

Lines of Context:
505
505
                             MillisecondsValueArgumentMixIn):
506
506
    property = "ApprovalDuration"
507
507
 
508
 
def has_actions(options):
509
 
    return any((options.enable,
510
 
                options.disable,
511
 
                options.bump_timeout,
512
 
                options.start_checker,
513
 
                options.stop_checker,
514
 
                options.is_enabled,
515
 
                options.remove,
516
 
                options.checker is not None,
517
 
                options.timeout is not None,
518
 
                options.extended_timeout is not None,
519
 
                options.interval is not None,
520
 
                options.approved_by_default is not None,
521
 
                options.approval_delay is not None,
522
 
                options.approval_duration is not None,
523
 
                options.host is not None,
524
 
                options.secret is not None,
525
 
                options.approve,
526
 
                options.deny))
527
 
 
528
508
def add_command_line_options(parser):
529
509
    parser.add_argument("--version", action="version",
530
510
                        version="%(prog)s {}".format(version),
671
651
 
672
652
    options = parser.parse_args()
673
653
 
 
654
    def has_actions(options):
 
655
        return any((options.enable,
 
656
                    options.disable,
 
657
                    options.bump_timeout,
 
658
                    options.start_checker,
 
659
                    options.stop_checker,
 
660
                    options.is_enabled,
 
661
                    options.remove,
 
662
                    options.checker is not None,
 
663
                    options.timeout is not None,
 
664
                    options.extended_timeout is not None,
 
665
                    options.interval is not None,
 
666
                    options.approved_by_default is not None,
 
667
                    options.approval_delay is not None,
 
668
                    options.approval_duration is not None,
 
669
                    options.host is not None,
 
670
                    options.secret is not None,
 
671
                    options.approve,
 
672
                    options.deny))
 
673
 
674
674
    if has_actions(options) and not (options.client or options.all):
675
675
        parser.error("Options require clients names or --all.")
676
676
    if options.verbose and has_actions(options):