/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: 2014-07-17 03:24:57 UTC
  • mto: This revision was merged to the branch mainline in revision 720.
  • Revision ID: teddy@recompile.se-20140717032457-7074pobx7ft1oiio
Tags: version-1.6.7-1
* Makefile (version): Changed to "1.6.7".
* NEWS (Version 1.6.7): New entry.
* debian/changelog (1.6.7-1): - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from __future__ import (division, absolute_import, print_function,
27
27
                        unicode_literals)
28
28
 
29
 
from future_builtins import *
 
29
try:
 
30
    from future_builtins import *
 
31
except ImportError:
 
32
    pass
30
33
 
31
34
import sys
32
35
import argparse
39
42
 
40
43
import dbus
41
44
 
 
45
if sys.version_info[0] == 2:
 
46
    str = unicode
 
47
 
42
48
locale.setlocale(locale.LC_ALL, "")
43
49
 
44
50
tablewords = {
66
72
server_path = "/"
67
73
server_interface = domain + ".Mandos"
68
74
client_interface = domain + ".Mandos.Client"
69
 
version = "1.6.5"
 
75
version = "1.6.7"
70
76
 
71
77
def timedelta_to_milliseconds(td):
72
78
    """Convert a datetime.timedelta object to milliseconds"""
230
236
        if keyword in ("Timeout", "Interval", "ApprovalDelay",
231
237
                       "ApprovalDuration", "ExtendedTimeout"):
232
238
            return milliseconds_to_string(value)
233
 
        return unicode(value)
 
239
        return str(value)
234
240
    
235
241
    # Create format string to print table rows
236
242
    format_string = " ".join("{{{key}:{width}}}".format(
310
316
    parser.add_argument("--approval-duration",
311
317
                        help="Set duration of one client approval")
312
318
    parser.add_argument("-H", "--host", help="Set host for client")
313
 
    parser.add_argument("-s", "--secret", type=file,
 
319
    parser.add_argument("-s", "--secret",
 
320
                        type=argparse.FileType(mode="rb"),
314
321
                        help="Set password blob (file) for client")
315
322
    parser.add_argument("-A", "--approve", action="store_true",
316
323
                        help="Approve any current client request")
367
374
    if options.all or not options.client:
368
375
        clients = dict((bus.get_object(busname, path), properties)
369
376
                       for path, properties in
370
 
                       mandos_clients.iteritems())
 
377
                       mandos_clients.items())
371
378
    else:
372
379
        for name in options.client:
373
380
            for path, client in mandos_clients.iteritems():