Merge from head.
[nodemanager.git] / bootauth.py
index a946db3..e2ad8fb 100755 (executable)
@@ -9,7 +9,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id$
+# $Id: bootauth.py,v 1.2 2006/11/18 18:16:40 mlhuang Exp $
 #
 
 import os, sys
@@ -36,8 +36,9 @@ def main():
 
     # Get options
     try:
-        (opts, argv) = getopt.getopt(sys.argv[1:], "n:k:h",
-                                     ["node=", "nodeid=", "node-id", "node_id",
+        (opts, argv) = getopt.getopt(sys.argv[1:], "f:n:k:h",
+                                     ["config=", "cfg=", "file=",
+                                      "node=", "nodeid=", "node-id", "node_id",
                                       "key=",
                                       "help"])
     except getopt.GetoptError, err:
@@ -46,7 +47,7 @@ def main():
 
     for (opt, optval) in opts:
         if opt == "-f" or opt == "--config" or opt == "--cfg" or opt == "--file":
-            config = optval
+            config = Config(optval)
         elif opt == "-n" or opt == "--node" or opt == "--nodeid" or opt == "--node-id" or opt == "--node_id":
             if os.path.exists(optval):
                 node_id = file(optval).read().strip()
@@ -68,10 +69,10 @@ def main():
         usage()
 
     # Authenticate as the Boot Manager would and get a session key
-    plc = PLCAPI(config.plc_api_uri, (node_id, key))
+    plc = PLCAPI(config.plc_api_uri, config.cacert, (node_id, key))
     session = plc.BootGetNodeDetails()['session']
 
-    plc = PLCAPI(config.plc_api_uri, session)
+    plc = PLCAPI(config.plc_api_uri, config.cacert, session)
     assert session == plc.GetSession()
 
     print session