X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Fplanetlab%2Fnode.py;h=9ef4a1997f8d085d51b1fcbe536d7ff7ee0d5414;hb=cb5d027b813a27d7de263653e1a8e0cef5490f0a;hp=7f07d057ea4fa0e3ed4f735b4fa7d858fe3a5673;hpb=c01d40579e6d77f12327072dec0fb82c41676bb0;p=nepi.git diff --git a/src/nepi/resources/planetlab/node.py b/src/nepi/resources/planetlab/node.py index 7f07d057..9ef4a199 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 @@ -20,7 +19,7 @@ from nepi.execution.attribute import Attribute, Flags, Types from nepi.execution.resource import ResourceManager, clsinit_copy, \ - ResourceState, reschedule_delay + ResourceState from nepi.resources.linux.node import LinuxNode from nepi.resources.planetlab.plcapi import PLCAPIFactory from nepi.util.execfuncs import lexec @@ -37,10 +36,10 @@ import weakref @clsinit_copy class PlanetlabNode(LinuxNode): - _rtype = "PlanetlabNode" + _rtype = "planetlab::Node" _help = "Controls a PlanetLab host accessible using a SSH key " \ "associated to a PlanetLab user account" - _backend = "planetlab" + _platform = "planetlab" lock = threading.Lock() @@ -172,7 +171,6 @@ class PlanetlabNode(LinuxNode): default = False, flags = Flags.Global) - cls._register_attribute(ip) cls._register_attribute(pl_url) cls._register_attribute(pl_ptn) @@ -212,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")