raise BailOut
# TODO: log this
-
def lock(con, arg, hard):
if arg not in locks:
locks[arg]={'hard': hard, 'name': con.name, 'time': int(time.time())}
con.sock.send("HARD") # Hard lock - you can go get a cup of tea
else:
con.sock.send("SOFT") # Soft lock - try in a second or two
-
-
+
def cmd_unlock(con, arg):
if arg in locks:
del locks[arg]
def cmd_show_locks(con):
cmd_log(con, "Dumping locks data:");
if len(locks):
+ res = ""
for lockdata in locks.iteritems():
tree, data = lockdata
- cmd_log(con, "Tree: %s, Conn name: %s, Hard Lock: %s, Time: %s"
- % (tree, data['name'], data['hard'], time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(data['time']))))
+ msg = "Tree: %s, Conn name: %s, Hard Lock: %s, Time: %s" % (
+ tree, data['name'], data['hard'], time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(data['time'])))
+ cmd_log(con, msg)
+ res = res + msg
+# con.sock.send("BLOB:%d" % len(res))
+ con.sock.send(res)
else:
cmd_log(con, "No locks found.");
+ con.sock.send("NLCK");
def cmd_log(con, msg):
- logfile.write('%s [%s] -- %s\n' % (time.strftime('%Y-%m-%d %H:%M:%S'),
- con.name, msg))
+ logfile.write('%s [%s] -- %s\n' % (time.strftime('%Y-%m-%d %H:%M:%S'), con.name, msg))
logfile.flush()
def cmd_name(con, name):
self.__checksigns(dsttree, self.marked4moving, test = True)
self.__checkforobsoletes(dsttree, self.marked4moving, test = True)
self.__checkforrelease(dsttree, self.marked4moving, test = True)
-
+
if not self.treename.count("archive"):
self.__rmolderfromsrc(test = True)