mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Handle case where the lock doesn't exist : just assume we're the root logger
This commit is contained in:
parent
63ff02be50
commit
6c3a74c5ac
1 changed files with 6 additions and 0 deletions
|
@ -384,6 +384,12 @@ class OperationLogger(object):
|
||||||
# We are a child of the first one we found
|
# We are a child of the first one we found
|
||||||
return instance.name
|
return instance.name
|
||||||
|
|
||||||
|
# If no lock exists, we are probably in tests or yunohost is used as a
|
||||||
|
# lib ... let's not really care about that case and assume we're the
|
||||||
|
# root logger then.
|
||||||
|
if not os.path.exists("/var/run/moulinette_yunohost.lock"):
|
||||||
|
return None
|
||||||
|
|
||||||
locks = read_file("/var/run/moulinette_yunohost.lock").strip().split("\n")
|
locks = read_file("/var/run/moulinette_yunohost.lock").strip().split("\n")
|
||||||
# If we're the process with the lock, we're the root logger
|
# If we're the process with the lock, we're the root logger
|
||||||
if locks == [] or str(os.getpid()) in locks:
|
if locks == [] or str(os.getpid()) in locks:
|
||||||
|
|
Loading…
Add table
Reference in a new issue