/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: 2009-12-27 03:35:58 UTC
  • Revision ID: teddy@fukt.bsnet.se-20091227033558-y57wv1u4cls3i8kq
TODO file changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
locale.setlocale(locale.LC_ALL, u'')
25
25
 
26
 
import logging
27
 
logging.getLogger('dbus.proxies').setLevel(logging.CRITICAL)
28
 
 
29
26
# Some useful constants
30
27
domain = 'se.bsnet.fukt'
31
28
server_interface = domain + '.Mandos'
32
29
client_interface = domain + '.Mandos.Client'
33
 
version = "1.0.15"
 
30
version = "1.0.14"
34
31
 
35
32
# Always run in monochrome mode
36
33
urwid.curses_display.curses.has_colors = lambda : False
53
50
                                     self.property_changed,
54
51
                                     client_interface,
55
52
                                     byte_arrays=True)
56
 
        
 
53
 
57
54
        self.properties.update(
58
55
            self.proxy.GetAll(client_interface,
59
56
                              dbus_interface = dbus.PROPERTIES_IFACE))
60
57
        super(MandosClientPropertyCache, self).__init__(
61
 
            *args, **kwargs)
 
58
            proxy_object=proxy_object, *args, **kwargs)
62
59
    
63
60
    def property_changed(self, property=None, value=None):
64
61
        """This is called whenever we get a PropertyChanged signal
104
101
                                     self.got_secret,
105
102
                                     client_interface,
106
103
                                     byte_arrays=True)
107
 
        self.proxy.connect_to_signal(u"NeedApproval",
108
 
                                     self.need_approval,
109
 
                                     client_interface,
110
 
                                     byte_arrays=True)
111
104
        self.proxy.connect_to_signal(u"Rejected",
112
105
                                     self.rejected,
113
106
                                     client_interface,
115
108
    
116
109
    def checker_completed(self, exitstatus, condition, command):
117
110
        if exitstatus == 0:
118
 
            #self.logger(u'Checker for client %s (command "%s")'
119
 
            #            u' was successful'
120
 
            #            % (self.properties[u"name"], command))
 
111
            self.logger(u'Checker for client %s (command "%s")'
 
112
                        u' was successful'
 
113
                        % (self.properties[u"name"], command))
121
114
            return
122
115
        if os.WIFEXITED(condition):
123
116
            self.logger(u'Checker for client %s (command "%s")'
138
131
        self.logger(u'Checker for client %s completed mysteriously')
139
132
    
140
133
    def checker_started(self, command):
141
 
        #self.logger(u'Client %s started checker "%s"'
142
 
        #            % (self.properties[u"name"], unicode(command)))
143
 
        pass
 
134
        self.logger(u'Client %s started checker "%s"'
 
135
                    % (self.properties[u"name"], unicode(command)))
144
136
    
145
137
    def got_secret(self):
146
138
        self.logger(u'Client %s received its secret'
147
139
                    % self.properties[u"name"])
148
140
    
149
 
    def need_approval(self, timeout, default):
150
 
        if not default:
151
 
            message = u'Client %s needs approval within %s seconds'
152
 
        else:
153
 
            message = u'Client %s will get its secret in %s seconds'
154
 
        self.logger(message
155
 
                    % (self.properties[u"name"], timeout/1000))
156
 
    
157
 
    def rejected(self, reason):
158
 
        self.logger(u'Client %s was rejected; reason: %s'
159
 
                    % (self.properties[u"name"], reason))
 
141
    def rejected(self):
 
142
        self.logger(u'Client %s was rejected'
 
143
                    % self.properties[u"name"])
160
144
    
161
145
    def selectable(self):
162
146
        """Make this a "selectable" widget.
241
225
#             self.proxy.unpause()
242
226
#         elif key == u"RET":
243
227
#             self.open()
244
 
        elif key == u"+":
245
 
            self.proxy.Approve(True)
246
 
        elif key == u"-":
247
 
            self.proxy.Approve(False)
248
228
        else:
249
229
            return key
250
230