logging.error("List of CTA tape pools is empty, nothing to do, exiting")
sys.exit(0)
# Extract the list of DISABLED tape libraries
# LATER as --json not yet implemented
#logging.debug("List of extracted tape pools from CTA:\n" + format(tapepools))
# Iterate over the extracted CTA tape pools and re-fill them with supply tapes as needed
for tapepool in tapepools:
logging.info("Tape pool: " + tapepool["name"] + " which should have at least: " + tapepool["numPartialTapes"] + " partial tape(s) is supplied from: " + tapepool["supply"])
if (tapepool["numPartialTapes"] and tapepool["supply"]):
# Check if re-filling is actually needed
currentpartialtapes = len([tape for tape in extract_tapes("ALL", tapepool["name"])])
if (currentpartialtapes < int(tapepool["numPartialTapes"])):
logging.info("Tape: " + format(supplytapes[i]) + " moved to the pool: " + tapepool["name"])
else:
logging.warn("Unable to re-fill the tape pool: " + tapepool["name"] + ", no eligible supply tapes identified")
else:
logging.warn("Unable to re-fill the tape pool: " + tapepool["name"] + " because either the number of partial tapes: " + tapepool["numPartialTapes"] + " or the supply pool: " + tapepool["supply"] + " is not properly configured")