while not self.lock():
time.sleep(60)
+ def unlockfailed(self):
+ # unlock target as usual and increase its counter by 10
+ if not self.unlock():
+ logging.warn("Unlock failed: %s", self.target)
+ uuid = UUID_PREFIX + self.target
+ UUIDlist.set_cnt(uuid, UUIDlist.get_cnt(uuid)+10)
+
def parse_arguments():
parser = argparse.ArgumentParser(description="Manager of locks on UUID files")
action="store_true", default=False, dest="unlock",
help="Unlock a device")
+ group.add_argument("-f", "--unlockfailed",
+ action="store_true", default=False, dest="unlockfailed",
+ help="Unlock a device and increment counter by 10")
+
parser.add_argument("-L", "--log",
action="store", dest="loglevel",
help="Verbosity level")
logging.warn("File unlocking unsuccessful!")
elif args.retrylock:
uuid_man.retrylock()
+ elif args.unlockfailed:
+ uuid_man.unlockfailed()
logging.debug("End")
if __name__ == '__main__':