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")
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!