13
13
locale.setlocale(locale.LC_ALL, u'')
17
'enabled': u'Enabled',
18
'timeout': u'Timeout',
19
'last_checked_ok': u'Last Successful Check',
20
'created': u'Created',
21
'interval': u'Interval',
23
'fingerprint': u'Fingerprint',
24
'checker_running': u'Check Is Running',
25
'last_enabled': u'Last Enabled',
26
'checker': u'Checker',
17
'Enabled': u'Enabled',
18
'Timeout': u'Timeout',
19
'LastCheckedOK': u'Last Successful Check',
20
'Created': u'Created',
21
'Interval': u'Interval',
23
'Fingerprint': u'Fingerprint',
24
'CheckerRunning': u'Check Is Running',
25
'LastEnabled': u'Last Enabled',
26
'Checker': u'Checker',
28
defaultkeywords = ('name', 'enabled', 'timeout', 'last_checked_ok')
28
defaultkeywords = ('Name', 'Enabled', 'Timeout', 'LastCheckedOK')
29
29
domain = 'se.bsnet.fukt'
30
30
busname = domain + '.Mandos'
100
100
# Create format string to print table rows
101
101
format_string = u' '.join(u'%%-%ds' %
102
102
max(len(tablewords[key]),
103
max(len(valuetostring(client[key], key))
103
max(len(valuetostring(client[key],
106
107
for key in keywords)
203
204
for name in client_names:
204
205
for path, client in mandos_clients.iteritems():
205
if client['name'] == name:
206
if client['Name'] == name:
206
207
client_objc = bus.get_object(busname, path)
207
208
clients.append(client_objc)
213
214
if not has_actions(options) and clients:
214
215
if options.verbose:
215
keywords = ('name', 'enabled', 'timeout', 'last_checked_ok',
216
'created', 'interval', 'host', 'fingerprint',
217
'checker_running', 'last_enabled', 'checker')
216
keywords = ('Name', 'Enabled', 'Timeout', 'LastCheckedOK',
217
'Created', 'Interval', 'Host', 'Fingerprint',
218
'CheckerRunning', 'LastEnabled', 'Checker')
219
220
keywords = defaultkeywords
236
237
client.StopChecker(dbus_interface=client_interface)
237
238
if options.is_enabled:
238
239
sys.exit(0 if client.Get(client_interface,
240
241
dbus_interface=dbus.PROPERTIES_IFACE)
242
243
if options.checker:
243
client.Set(client_interface, u"checker", options.checker,
244
client.Set(client_interface, u"Checker", options.checker,
244
245
dbus_interface=dbus.PROPERTIES_IFACE)
246
client.Set(client_interface, u"host", options.host,
247
client.Set(client_interface, u"Host", options.host,
247
248
dbus_interface=dbus.PROPERTIES_IFACE)
248
249
if options.interval:
249
client.Set(client_interface, u"interval",
250
client.Set(client_interface, u"Interval",
250
251
timedelta_to_milliseconds
251
252
(string_to_delta(options.interval)),
252
253
dbus_interface=dbus.PROPERTIES_IFACE)
253
254
if options.timeout:
254
client.Set(client_interface, u"timeout",
255
client.Set(client_interface, u"Timeout",
255
256
timedelta_to_milliseconds(string_to_delta
256
257
(options.timeout)),
257
258
dbus_interface=dbus.PROPERTIES_IFACE)
258
259
if options.secret:
259
client.Set(client_interface, u"secret",
260
client.Set(client_interface, u"Secret",
260
261
dbus.ByteArray(open(options.secret, u'rb').read()),
261
262
dbus_interface=dbus.PROPERTIES_IFACE)
262
263
if options.approve: