/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 at bsnet
  • Date: 2010-08-31 18:22:25 UTC
  • mto: (24.1.154 mandos)
  • mto: This revision was merged to the branch mainline in revision 421.
  • Revision ID: teddy@fukt.bsnet.se-20100831182225-sad2cgilj3jeduab
* mandos-monitor (MandosClientWidget): Accept new signal
                                       "NeedApproval".
  (MandosClientWidget.checker_completed): Don't log successful
                                          checkers.
  (MandosClientWidget.checker_started): Don't log.
  (MandosClientWidget.need_approval): New; just log a message.
  (MandosClientWidget.rejected): Take an additional "reason" argument.
  (MandosClientWidget.keypress): Accept "+" and "-" keys to accept or
                                 reject, respectively.

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
                                     self.got_secret,
105
105
                                     client_interface,
106
106
                                     byte_arrays=True)
 
107
        self.proxy.connect_to_signal(u"NeedApproval",
 
108
                                     self.need_approval,
 
109
                                     client_interface,
 
110
                                     byte_arrays=True)
107
111
        self.proxy.connect_to_signal(u"Rejected",
108
112
                                     self.rejected,
109
113
                                     client_interface,
111
115
    
112
116
    def checker_completed(self, exitstatus, condition, command):
113
117
        if exitstatus == 0:
114
 
            self.logger(u'Checker for client %s (command "%s")'
115
 
                        u' was successful'
116
 
                        % (self.properties[u"name"], command))
 
118
            #self.logger(u'Checker for client %s (command "%s")'
 
119
            #            u' was successful'
 
120
            #            % (self.properties[u"name"], command))
117
121
            return
118
122
        if os.WIFEXITED(condition):
119
123
            self.logger(u'Checker for client %s (command "%s")'
134
138
        self.logger(u'Checker for client %s completed mysteriously')
135
139
    
136
140
    def checker_started(self, command):
137
 
        self.logger(u'Client %s started checker "%s"'
138
 
                    % (self.properties[u"name"], unicode(command)))
 
141
        #self.logger(u'Client %s started checker "%s"'
 
142
        #            % (self.properties[u"name"], unicode(command)))
 
143
        pass
139
144
    
140
145
    def got_secret(self):
141
146
        self.logger(u'Client %s received its secret'
142
147
                    % self.properties[u"name"])
143
148
    
144
 
    def rejected(self):
145
 
        self.logger(u'Client %s was rejected'
146
 
                    % self.properties[u"name"])
 
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))
147
160
    
148
161
    def selectable(self):
149
162
        """Make this a "selectable" widget.
228
241
#             self.proxy.unpause()
229
242
#         elif key == u"RET":
230
243
#             self.open()
 
244
        elif key == u"+":
 
245
            self.proxy.Approve(True)
 
246
        elif key == u"-":
 
247
            self.proxy.Approve(False)
231
248
        else:
232
249
            return key
233
250