13
13
locale.setlocale(locale.LC_ALL, u'')
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',
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',
28
defaultkeywords = ('Name', 'Enabled', 'Timeout', 'LastCheckedOK')
28
defaultkeywords = ('name', 'enabled', 'timeout', 'last_checked_ok')
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],
103
max(len(valuetostring(client[key], key))
107
106
for key in keywords)
204
203
for name in client_names:
205
204
for path, client in mandos_clients.iteritems():
206
if client['Name'] == name:
205
if client['name'] == name:
207
206
client_objc = bus.get_object(busname, path)
208
207
clients.append(client_objc)
214
213
if not has_actions(options) and clients:
215
214
if options.verbose:
216
keywords = ('Name', 'Enabled', 'Timeout', 'LastCheckedOK',
217
'Created', 'Interval', 'Host', 'Fingerprint',
218
'CheckerRunning', 'LastEnabled', 'Checker')
215
keywords = ('name', 'enabled', 'timeout', 'last_checked_ok',
216
'created', 'interval', 'host', 'fingerprint',
217
'checker_running', 'last_enabled', 'checker')
220
219
keywords = defaultkeywords
237
236
client.StopChecker(dbus_interface=client_interface)
238
237
if options.is_enabled:
239
238
sys.exit(0 if client.Get(client_interface,
241
240
dbus_interface=dbus.PROPERTIES_IFACE)
243
242
if options.checker:
244
client.Set(client_interface, u"Checker", options.checker,
243
client.Set(client_interface, u"checker", options.checker,
245
244
dbus_interface=dbus.PROPERTIES_IFACE)
247
client.Set(client_interface, u"Host", options.host,
246
client.Set(client_interface, u"host", options.host,
248
247
dbus_interface=dbus.PROPERTIES_IFACE)
249
248
if options.interval:
250
client.Set(client_interface, u"Interval",
249
client.Set(client_interface, u"interval",
251
250
timedelta_to_milliseconds
252
251
(string_to_delta(options.interval)),
253
252
dbus_interface=dbus.PROPERTIES_IFACE)
254
253
if options.timeout:
255
client.Set(client_interface, u"Timeout",
254
client.Set(client_interface, u"timeout",
256
255
timedelta_to_milliseconds(string_to_delta
257
256
(options.timeout)),
258
257
dbus_interface=dbus.PROPERTIES_IFACE)
259
258
if options.secret:
260
client.Set(client_interface, u"Secret",
259
client.Set(client_interface, u"secret",
261
260
dbus.ByteArray(open(options.secret, u'rb').read()),
262
261
dbus_interface=dbus.PROPERTIES_IFACE)
263
262
if options.approve: