patch by Thomas Dreibholz - ovs-vsctl and not ovs-ovsctl
[nodemanager.git] / bootauth.py
index 445891e..5c9dfa7 100755 (executable)
@@ -1,16 +1,11 @@
 #!/usr/bin/python
 #
-# $Id$
-# $URL$
-#
-# Test script for obtaining a node session key. Usually, the Boot
+# Obtaining a node session key. Usually, the Boot
 # Manager obtains it, then writes it to /etc/planetlab/session.
 #
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id$
-#
 
 import os, sys
 import getopt
@@ -50,12 +45,14 @@ def main():
             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()
+                with open(optval) as optfile:
+                    node_id = optfile.read().strip()
             else:
                 node_id = int(optval)
         elif opt == "-k" or opt == "--key":
             if os.path.exists(optval):
-                key = file(optval).read().strip()
+                with open(optval) as optfile:
+                    key = optfile.read().strip()
             else:
                 key = optval
         else: