mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Add an 'init' helper for scripts/tests to initialize everything needed...
This commit is contained in:
parent
7df8e8421d
commit
84e39a416a
1 changed files with 13 additions and 0 deletions
|
@ -72,6 +72,19 @@ def check_command_is_valid_before_postinstall(args):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def init(interface="cli", debug=False, quiet=False, logdir="/var/log/yunohost"):
|
||||||
|
"""
|
||||||
|
This is a small util function ONLY meant to be used to initialize a Yunohost
|
||||||
|
context when ran from tests or from scripts.
|
||||||
|
"""
|
||||||
|
init_logging(interface=interface, debug=debug, quiet=quiet, logdir=logdir)
|
||||||
|
init_i18n()
|
||||||
|
from moulinette.core import MoulinetteLock
|
||||||
|
lock = MoulinetteLock("yunohost", timeout=30)
|
||||||
|
lock.acquire()
|
||||||
|
return lock
|
||||||
|
|
||||||
|
|
||||||
def init_i18n():
|
def init_i18n():
|
||||||
# This should only be called when not willing to go through moulinette.cli
|
# This should only be called when not willing to go through moulinette.cli
|
||||||
# or moulinette.api but still willing to call m18n.n/g...
|
# or moulinette.api but still willing to call m18n.n/g...
|
||||||
|
|
Loading…
Add table
Reference in a new issue