merge from 2.0 branch
[monitor.git] / monitor / getsshkeys.py
index d362c94..1068c5f 100755 (executable)
@@ -15,17 +15,17 @@ except:
        print traceback.print_exc()
        auth = {'AuthMethod' : "anonymous"}
 
-args = {}
-args['known_hosts'] =  os.environ['HOME'] + os.sep + ".ssh" + os.sep + "known_hosts"
-try:
-       from monitor import config
-       args['XMLRPC_SERVER'] = config.API_SERVER
-except:
-       args['XMLRPC_SERVER'] = 'https://boot.planet-lab.org/PLCAPI/'
-       print "Using default API server %s" %  args['XMLRPC_SERVER']
 
 class SSHKnownHosts:
-       def __init__(self, args = args):
+       def __init__(self, args = None):
+               if not args: args = {}
+               args['known_hosts'] =  os.environ['HOME'] + os.sep + ".ssh" + os.sep + "known_hosts"
+               try:
+                       from monitor import config
+                       args['XMLRPC_SERVER'] = config.API_SERVER
+               except:
+                       args['XMLRPC_SERVER'] = 'https://boot.planet-lab.org/PLCAPI/'
+                       print "Using default API server %s" %  args['XMLRPC_SERVER']
                self.args = args
                self.read_knownhosts()
                self.auth = auth