/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-23 00:58:49 UTC
  • Revision ID: teddy@recompile.se-20120623005849-02wj82cng433rt2k
* clients.conf: Convert all time intervals to new RFC 3339 syntax.
* mandos: All client options for time intervals now take an RFC 3339
          duration.
  (rfc3339_duration_to_delta): New function.
  (string_to_delta): Try rfc3339_duration_to_delta first.
* mandos-clients.conf.xml (OPTIONS/timeout): Document new format.
  (EXAMPLE): Update to new interval format.
  (SEE ALSO): Reference RFC 3339.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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()