X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Fplanetlab%2Fnode.py;h=c6f7bde861087ddd15ae19df13fc122da88ca7e4;hb=6285ca51026efb69642eea9dfc7c480e722d84a9;hp=6687a0fdc06d7dda1d4fb1b1a72ab8365c1d8f61;hpb=23d041fe2f0d9badf6d637009e2d42a4794325c1;p=nepi.git diff --git a/src/nepi/resources/planetlab/node.py b/src/nepi/resources/planetlab/node.py index 6687a0fd..c6f7bde8 100644 --- a/src/nepi/resources/planetlab/node.py +++ b/src/nepi/resources/planetlab/node.py @@ -3,9 +3,8 @@ # Copyright (C) 2013 INRIA # # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -211,10 +210,12 @@ class PlanetlabNode(LinuxNode): plblacklist_file = os.path.join(nepi_home, "plblacklist.txt") if not os.path.exists(plblacklist_file): if os.path.isdir(nepi_home): - open(plblacklist_file, 'w').close() + with open(plblacklist_file, 'w') as clear: + pass else: os.makedirs(nepi_home) - open(plblacklist_file, 'w').close() + with open(plblacklist_file, 'w') as clear: + pass def _skip_provision(self): pl_user = self.get("pluser") @@ -660,24 +661,24 @@ class PlanetlabNode(LinuxNode): def fail_discovery(self): msg = "Discovery failed. No candidates found for node" self.error(msg) - raise RuntimeError, msg + raise RuntimeError(msg) def fail_node_not_alive(self, hostname=None): msg = "Node %s not alive" % hostname - raise RuntimeError, msg + raise RuntimeError(msg) def fail_node_not_available(self, hostname): msg = "Node %s not available for provisioning" % hostname - raise RuntimeError, msg + raise RuntimeError(msg) def fail_not_enough_nodes(self): msg = "Not enough nodes available for provisioning" - raise RuntimeError, msg + raise RuntimeError(msg) def fail_plapi(self): msg = "Failing while trying to instanciate the PLC API.\nSet the" + \ " attributes pluser and plpassword." - raise RuntimeError, msg + raise RuntimeError(msg) def valid_connection(self, guid): # TODO: Validate!