mirror of
https://github.com/ThomasGsp/HyperProxmox.git
synced 2025-02-15 04:32:15 +00:00
locker fix issue
This commit is contained in:
parent
855b81dc65
commit
844b965ab3
1 changed files with 5 additions and 4 deletions
|
@ -1,19 +1,20 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
class Locker:
|
class Locker:
|
||||||
def createlock(self, lockfile, date=0):
|
def createlock(self, lockfile, position, date=0):
|
||||||
try:
|
try:
|
||||||
if os.path.exists(lockfile):
|
if os.path.exists(lockfile):
|
||||||
f = open(lockfile, "r+")
|
f = open(lockfile, "r+")
|
||||||
return f.read()
|
return f.read()
|
||||||
else:
|
else:
|
||||||
f = open(lockfile, "w")
|
f = open(lockfile, "w")
|
||||||
f.write(date)
|
f.write(str(date))
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
raise("Can't create or read the lock file: {0}".format(e))
|
raise("Can't create or read the lock file: {0}".format(e))
|
||||||
|
|
||||||
def unlock(self, lockfile):
|
def unlock(self, lockfile, position):
|
||||||
try:
|
try:
|
||||||
os.remove(lockfile)
|
os.remove(lockfile)
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
raise ("Can't delete the lock file: {0}".format(e))
|
if position != "startup":
|
||||||
|
print("Can't delete the lock file: {0}".format(e))
|
Loading…
Reference in a new issue