/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-monitor

  • Committer: Teddy Hogeborn
  • Date: 2016-06-27 20:21:50 UTC
  • Revision ID: teddy@recompile.se-20160627202150-ml201ilxwjf1g29w
mandos-ctl: Implement --dump-json option

* mandos-ctl (main): Implement --dump-json option
* mandos-ctl.xml (NAME, DESCRIPTION): Change description to the more
                                      accurate "control or query".
  (SYNOPSIS): Add required group around action options and add new
              "--dump-json" option.
  (OPTIONS): Document new "--dump-json" option.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
import urwid
40
40
 
41
41
from dbus.mainloop.glib import DBusGMainLoop
42
 
try:
43
 
    from gi.repository import GObject
44
 
except ImportError:
45
 
    import gobject as GObject
 
42
from gi.repository import GLib
46
43
 
47
44
import dbus
48
45
 
60
57
domain = 'se.recompile'
61
58
server_interface = domain + '.Mandos'
62
59
client_interface = domain + '.Mandos.Client'
63
 
version = "1.7.4"
 
60
version = "1.7.10"
64
61
 
65
62
try:
66
63
    dbus.OBJECT_MANAGER_IFACE
172
169
        """
173
170
        if flag and self._update_timer_callback_tag is None:
174
171
            # Will update the shown timer value every second
175
 
            self._update_timer_callback_tag = (GObject.timeout_add
 
172
            self._update_timer_callback_tag = (GLib.timeout_add
176
173
                                               (1000,
177
174
                                                self.update_timer))
178
175
        elif not (flag or self._update_timer_callback_tag is None):
179
 
            GObject.source_remove(self._update_timer_callback_tag)
 
176
            GLib.source_remove(self._update_timer_callback_tag)
180
177
            self._update_timer_callback_tag = None
181
178
    
182
179
    def checker_completed(self, exitstatus, condition, command):
309
306
            self.update_hook()
310
307
    
311
308
    def update_timer(self):
312
 
        """called by GObject. Will indefinitely loop until
313
 
        GObject.source_remove() on tag is called"""
 
309
        """called by GLib. Will indefinitely loop until
 
310
        GLib.source_remove() on tag is called
 
311
        """
314
312
        self.update()
315
313
        return True             # Keep calling this
316
314
    
317
315
    def delete(self, **kwargs):
318
316
        if self._update_timer_callback_tag is not None:
319
 
            GObject.source_remove(self._update_timer_callback_tag)
 
317
            GLib.source_remove(self._update_timer_callback_tag)
320
318
            self._update_timer_callback_tag = None
321
319
        for match in self.match_objects:
322
320
            match.remove()
465
463
                              "q: Quit  ?: Help"))
466
464
        
467
465
        self.busname = domain + '.Mandos'
468
 
        self.main_loop = GObject.MainLoop()
 
466
        self.main_loop = GLib.MainLoop()
469
467
    
470
468
    def client_not_found(self, fingerprint, address):
471
469
        self.log_message("Client with address {} and fingerprint {}"
640
638
                            path=path)
641
639
        
642
640
        self.refresh()
643
 
        self._input_callback_tag = (GObject.io_add_watch
 
641
        self._input_callback_tag = (GLib.io_add_watch
644
642
                                    (sys.stdin.fileno(),
645
 
                                     GObject.IO_IN,
 
643
                                     GLib.IO_IN,
646
644
                                     self.process_input))
647
645
        self.main_loop.run()
648
646
        # Main loop has finished, we should close everything now
649
 
        GObject.source_remove(self._input_callback_tag)
 
647
        GLib.source_remove(self._input_callback_tag)
650
648
        self.screen.stop()
651
649
    
652
650
    def stop(self):