/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 at bsnet
  • Date: 2011-11-12 18:14:55 UTC
  • mto: This revision was merged to the branch mainline in revision 522.
  • Revision ID: teddy@fukt.bsnet.se-20111112181455-8m6z4qrrib33bl2c
* plugins.d/mandos-client.c (SYNOPSIS, OPTIONS): Document
                                                 "--network-hook-dir"
                                                 option.

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
    >>> string_to_delta("5m 30s")
94
94
    datetime.timedelta(0, 330)
95
95
    """
96
 
    value = datetime.timedelta(0)
97
 
    regexp = re.compile("(\d+)([dsmhw]?)")
 
96
    timevalue = datetime.timedelta(0)
 
97
    regexp = re.compile("\d+[dsmhw]")
98
98
    
99
 
    for num, suffix in regexp.findall(interval):
100
 
        if suffix == "d":
101
 
            value += datetime.timedelta(int(num))
102
 
        elif suffix == "s":
103
 
            value += datetime.timedelta(0, int(num))
104
 
        elif suffix == "m":
105
 
            value += datetime.timedelta(0, 0, 0, 0, int(num))
106
 
        elif suffix == "h":
107
 
            value += datetime.timedelta(0, 0, 0, 0, 0, int(num))
108
 
        elif suffix == "w":
109
 
            value += datetime.timedelta(0, 0, 0, 0, 0, 0, int(num))
110
 
        elif suffix == "":
111
 
            value += datetime.timedelta(0, 0, 0, int(num))
112
 
    return value
 
99
    for s in regexp.findall(interval):
 
100
        try:
 
101
            suffix = unicode(s[-1])
 
102
            value = int(s[:-1])
 
103
            if suffix == "d":
 
104
                delta = datetime.timedelta(value)
 
105
            elif suffix == "s":
 
106
                delta = datetime.timedelta(0, value)
 
107
            elif suffix == "m":
 
108
                delta = datetime.timedelta(0, 0, 0, 0, value)
 
109
            elif suffix == "h":
 
110
                delta = datetime.timedelta(0, 0, 0, 0, 0, value)
 
111
            elif suffix == "w":
 
112
                delta = datetime.timedelta(0, 0, 0, 0, 0, 0, value)
 
113
            else:
 
114
                raise ValueError
 
115
        except (ValueError, IndexError):
 
116
            raise ValueError
 
117
        timevalue += delta
 
118
    return timevalue
113
119
 
114
120
def print_clients(clients, keywords):
115
121
    def valuetostring(value, keyword):