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

  • Committer: Teddy Hogeborn
  • Date: 2012-06-24 03:45:55 UTC
  • Revision ID: teddy@recompile.se-20120624034555-7p0dtbpsz0dgsn4d
* mandos (Client.start_checker): Add comment.  Break long line.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
4
4
# Mandos Monitor - Control and monitor the Mandos server
5
5
6
 
# Copyright © 2008-2014 Teddy Hogeborn
7
 
# Copyright © 2008-2014 Björn Påhlsson
 
6
# Copyright © 2008-2012 Teddy Hogeborn
 
7
# Copyright © 2008-2012 Björn Påhlsson
8
8
9
9
# This program is free software: you can redistribute it and/or modify
10
10
# it under the terms of the GNU General Public License as published by
66
66
server_path = "/"
67
67
server_interface = domain + ".Mandos"
68
68
client_interface = domain + ".Mandos.Client"
69
 
version = "1.6.4"
 
69
version = "1.6.0"
70
70
 
71
71
def timedelta_to_milliseconds(td):
72
72
    """Convert a datetime.timedelta object to milliseconds"""
199
199
    >>> string_to_delta("5m 30s")
200
200
    datetime.timedelta(0, 330)
201
201
    """
 
202
    value = datetime.timedelta(0)
 
203
    regexp = re.compile(r"(\d+)([dsmhw]?)")
202
204
    
203
205
    try:
204
206
        return rfc3339_duration_to_delta(interval)
205
207
    except ValueError:
206
208
        pass
207
209
    
208
 
    value = datetime.timedelta(0)
209
 
    regexp = re.compile(r"(\d+)([dsmhw]?)")
210
 
    
211
210
    for num, suffix in regexp.findall(interval):
212
211
        if suffix == "d":
213
212
            value += datetime.timedelta(int(num))
331
330
 
332
331
    if options.check:
333
332
        fail_count, test_count = doctest.testmod()
334
 
        sys.exit(os.EX_OK if fail_count == 0 else 1)
 
333
        sys.exit(0 if fail_count == 0 else 1)
335
334
    
336
335
    try:
337
336
        bus = dbus.SystemBus()