/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-02-15 19:53:46 UTC
  • mto: This revision was merged to the branch mainline in revision 465.
  • Revision ID: teddy@fukt.bsnet.se-20110215195346-6eps2j007o8xcr0e
* mandos-ctl: Use print function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
# Contact the authors at <mandos@fukt.bsnet.se>.
23
23
24
24
 
25
 
from __future__ import division, absolute_import, unicode_literals
 
25
from __future__ import (division, absolute_import, print_function,
 
26
                        unicode_literals)
26
27
 
27
28
import sys
28
29
import dbus
134
135
                                     clients))
135
136
                             for key in keywords)
136
137
    # Print header line
137
 
    print format_string % tuple(tablewords[key] for key in keywords)
 
138
    print(format_string % tuple(tablewords[key] for key in keywords))
138
139
    for client in clients:
139
 
        print format_string % tuple(valuetostring(client[key], key)
140
 
                                    for key in keywords)
 
140
        print(format_string % tuple(valuetostring(client[key], key)
 
141
                                    for key in keywords))
141
142
 
142
143
def has_actions(options):
143
144
    return any((options.enable,
216
217
            bus = dbus.SystemBus()
217
218
            mandos_dbus_objc = bus.get_object(busname, server_path)
218
219
        except dbus.exceptions.DBusException:
219
 
            print >> sys.stderr, "Could not connect to Mandos server"
 
220
            print("Could not connect to Mandos server",
 
221
                  file=sys.stderr)
220
222
            sys.exit(1)
221
223
    
222
224
        mandos_serv = dbus.Interface(mandos_dbus_objc,
235
237
                os.dup2(stderrcopy, sys.stderr.fileno())
236
238
                os.close(stderrcopy)
237
239
        except dbus.exceptions.DBusException, e:
238
 
            print >> sys.stderr, "Access denied: Accessing mandos server through dbus."
 
240
            print("Access denied: Accessing mandos server through dbus.",
 
241
                  file=sys.stderr)
239
242
            sys.exit(1)
240
243
            
241
244
        # Compile dict of (clients: properties) to process
253
256
                        clients[client_objc] = client
254
257
                        break
255
258
                else:
256
 
                    print >> sys.stderr, "Client not found on server: %r" % name
 
259
                    print("Client not found on server: %r" % name,
 
260
                          file=sys.stderr)
257
261
                    sys.exit(1)
258
262
            
259
263
        if not has_actions(options) and clients: