/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-23 16:00:26 UTC
  • Revision ID: teddy@recompile.se-20190323160026-u82ba6lkh7jeq0zj
mandos-ctl: Eliminate unnecessary D-Bus call

* mandos-ctl (command.Base.run): Don't set self.mandos.
  (command.Remove): Implement .run() instead of .run_on_one_client()
                    to avoid the command.Base.run() unnecessarily
                    connecting to a client object.

Show diffs side-by-side

added added

removed removed

Lines of Context:
556
556
but commands which want to operate on all clients at the same time can
557
557
override this run() method instead.
558
558
"""
559
 
            self.mandos = mandos
560
559
            for clientpath, properties in clients.items():
561
560
                log.debug("D-Bus: Connect to: (busname=%r, path=%r)",
562
561
                          dbus_busname, str(clientpath))
593
592
 
594
593
 
595
594
    class Remove(Base):
596
 
        def run_on_one_client(self, client, properties):
597
 
            log.debug("D-Bus: %s:%s:%s.RemoveClient(%r)",
598
 
                      dbus_busname, server_dbus_path,
599
 
                      server_dbus_interface,
600
 
                      str(client.__dbus_object_path__))
601
 
            self.mandos.RemoveClient(client.__dbus_object_path__)
 
595
        def run(self, clients, bus, mandos):
 
596
            for clientpath in clients.keys():
 
597
                log.debug("D-Bus: %s:%s:%s.RemoveClient(%r)",
 
598
                          dbus_busname, server_dbus_path,
 
599
                          server_dbus_interface, clientpath)
 
600
                mandos.RemoveClient(clientpath)
602
601
 
603
602
 
604
603
    class Output(Base):