/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: 2019-03-03 22:09:38 UTC
  • Revision ID: teddy@recompile.se-20190303220938-92e8q07rtjdnpjh6
mandos-ctl: Refactor

* mandos-ctl (commands_and_clients_from_options): Take options as an
                                                  argument.  Move
                                                  parser setup into
                                                  new function and
                                                  move extra parse
                                                  checking into main.
  (add_command_line_options): New.
  (main): Create parser here and call add_command_line_options() to
          add options to it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
694
694
        def filter(self, record):
695
695
            return False
696
696
    dbus_filter = NullFilter()
 
697
    dbus_logger.addFilter(dbus_filter)
697
698
    try:
698
 
        dbus_logger.addFilter(dbus_filter)
699
 
        mandos_clients = {path: ifs_and_props[client_interface]
700
 
                          for path, ifs_and_props in
701
 
                          mandos_serv_object_manager
702
 
                          .GetManagedObjects().items()
703
 
                          if client_interface in ifs_and_props}
 
699
        try:
 
700
            mandos_clients = {path: ifs_and_props[client_interface]
 
701
                              for path, ifs_and_props in
 
702
                              mandos_serv_object_manager
 
703
                              .GetManagedObjects().items()
 
704
                              if client_interface in ifs_and_props}
 
705
        finally:
 
706
            # restore dbus logger
 
707
            dbus_logger.removeFilter(dbus_filter)
704
708
    except dbus.exceptions.DBusException as e:
705
709
        log.critical("Failed to access Mandos server through D-Bus:"
706
710
                     "\n%s", e)
707
711
        sys.exit(1)
708
 
    finally:
709
 
        # restore dbus logger
710
 
        dbus_logger.removeFilter(dbus_filter)
711
712
 
712
713
    # Compile dict of (clients: properties) to process
713
714
    clients = {}