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
from random import randint
import re
+import os
import time
import socket
import threading
@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"
default = False,
flags = Flags.Global)
-
cls._register_attribute(ip)
cls._register_attribute(pl_url)
cls._register_attribute(pl_ptn)
self.set("gateway", None)
self.set("gatewayUser", None)
+ # Blacklist file
+ nepi_home = os.path.join(os.path.expanduser("~"), ".nepi")
+ 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()
+ else:
+ os.makedirs(nepi_home)
+ open(plblacklist_file, 'w').close()
+
def _skip_provision(self):
pl_user = self.get("pluser")
pl_pass = self.get("plpassword")
def do_release(self):
super(PlanetlabNode, self).do_release()
- if self.state == ResourceState.RELEASED:
+ if self.state == ResourceState.RELEASED and not self._skip_provision():
self.debug(" Releasing PLC API ")
self.plapi.release()