X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=bootauth.py;h=5c9dfa778356ddc1df8b5595fe5dd1fa36fb3a48;hb=570d234b7d7b40416b296de71225f28c826ee991;hp=dae075c8a0b6a17301e944639ceccdb461566fde;hpb=3f01a8df5899602098c79b61b46ff54b48b1ae75;p=nodemanager.git diff --git a/bootauth.py b/bootauth.py index dae075c..5c9dfa7 100755 --- a/bootauth.py +++ b/bootauth.py @@ -45,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: