/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:48:29 UTC
  • Revision ID: teddy@recompile.se-20190303224829-ra6qltynsmegom8a
mandos-ctl: Refactor

* mandos-ctl (main): Convert try...try...finally...except into one
                     try...finally...except clause.

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)
698
697
    try:
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)
 
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}
708
704
    except dbus.exceptions.DBusException as e:
709
705
        log.critical("Failed to access Mandos server through D-Bus:"
710
706
                     "\n%s", e)
711
707
        sys.exit(1)
 
708
    finally:
 
709
        # restore dbus logger
 
710
        dbus_logger.removeFilter(dbus_filter)
712
711
 
713
712
    # Compile dict of (clients: properties) to process
714
713
    clients = {}