summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Admin/Xcmd.py
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2011-04-06 19:34:30 -0500
committerSol Jerome <sol.jerome@gmail.com>2011-04-06 19:35:21 -0500
commit742fc83dcdb82639b97723ce4cbfade75fb1aa71 (patch)
tree3c242e7029ab20f03300292d272e665c33c17943 /src/lib/Server/Admin/Xcmd.py
parente17608a61575ec9d50cfed34a80540257254840b (diff)
downloadbcfg2-742fc83dcdb82639b97723ce4cbfade75fb1aa71.tar.gz
bcfg2-742fc83dcdb82639b97723ce4cbfade75fb1aa71.tar.bz2
bcfg2-742fc83dcdb82639b97723ce4cbfade75fb1aa71.zip
bcfg2-admin: PY3K + PEP8 fixes
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Diffstat (limited to 'src/lib/Server/Admin/Xcmd.py')
-rw-r--r--src/lib/Server/Admin/Xcmd.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/lib/Server/Admin/Xcmd.py b/src/lib/Server/Admin/Xcmd.py
index 8ea98b79c..e761a5e3d 100644
--- a/src/lib/Server/Admin/Xcmd.py
+++ b/src/lib/Server/Admin/Xcmd.py
@@ -1,9 +1,10 @@
+import sys
+import xmlrpclib
+
import Bcfg2.Options
import Bcfg2.Proxy
import Bcfg2.Server.Admin
-import sys
-import xmlrpclib
class Xcmd(Bcfg2.Server.Admin.Mode):
__shorthelp__ = ("XML-RPC Command Interface")
@@ -16,8 +17,8 @@ class Xcmd(Bcfg2.Server.Admin.Mode):
'user': Bcfg2.Options.CLIENT_USER,
'password': Bcfg2.Options.SERVER_PASSWORD,
'key': Bcfg2.Options.SERVER_KEY,
- 'certificate' : Bcfg2.Options.CLIENT_CERT,
- 'ca' : Bcfg2.Options.CLIENT_CA
+ 'certificate': Bcfg2.Options.CLIENT_CERT,
+ 'ca': Bcfg2.Options.CLIENT_CA
}
setup = Bcfg2.Options.OptionParser(optinfo)
setup.parse(sys.argv[2:])
@@ -25,9 +26,10 @@ class Xcmd(Bcfg2.Server.Admin.Mode):
proxy = Bcfg2.Proxy.ComponentProxy(setup['server'],
setup['user'],
setup['password'],
- key = setup['key'],
- cert = setup['certificate'],
- ca = setup['ca'], timeout=180)
+ key=setup['key'],
+ cert=setup['certificate'],
+ ca=setup['ca'],
+ timeout=180)
if len(setup['args']) == 0:
print("Usage: xcmd <xmlrpc method> <optional arguments>")
return
@@ -36,7 +38,7 @@ class Xcmd(Bcfg2.Server.Admin.Mode):
if len(setup['args']) > 1:
args = tuple(setup['args'][1:])
try:
- data = apply(getattr(proxy, cmd), args)
+ data = getattr(proxy, cmd)(*args)
except xmlrpclib.Fault, flt:
if flt.faultCode == 7:
print("Unknown method %s" % cmd)
@@ -46,4 +48,4 @@ class Xcmd(Bcfg2.Server.Admin.Mode):
else:
raise
if data != None:
- print data
+ print(data)