mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Propagate changes from moulinette/simplify-interface-init
This commit is contained in:
parent
96e115c609
commit
d8be90165c
1 changed files with 2 additions and 11 deletions
|
@ -3,13 +3,13 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import glob
|
|
||||||
|
|
||||||
import moulinette
|
import moulinette
|
||||||
from moulinette import m18n
|
from moulinette import m18n
|
||||||
from moulinette.utils.log import configure_logging
|
from moulinette.utils.log import configure_logging
|
||||||
from moulinette.interfaces.cli import colorize, get_locale
|
from moulinette.interfaces.cli import colorize, get_locale
|
||||||
|
|
||||||
|
|
||||||
def is_installed():
|
def is_installed():
|
||||||
return os.path.isfile('/etc/yunohost/installed')
|
return os.path.isfile('/etc/yunohost/installed')
|
||||||
|
|
||||||
|
@ -23,11 +23,10 @@ def cli(debug, quiet, output_as, timeout, args, parser):
|
||||||
check_command_is_valid_before_postinstall(args)
|
check_command_is_valid_before_postinstall(args)
|
||||||
|
|
||||||
ret = moulinette.cli(
|
ret = moulinette.cli(
|
||||||
['yunohost'] + extensions(),
|
|
||||||
args,
|
args,
|
||||||
output_as=output_as,
|
output_as=output_as,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
parser_kwargs={'top_parser': parser},
|
top_parser=parser
|
||||||
)
|
)
|
||||||
sys.exit(ret)
|
sys.exit(ret)
|
||||||
|
|
||||||
|
@ -43,21 +42,13 @@ def api(debug, host, port):
|
||||||
# postinstall already done ...
|
# postinstall already done ...
|
||||||
|
|
||||||
ret = moulinette.api(
|
ret = moulinette.api(
|
||||||
['yunohost'] + extensions(),
|
|
||||||
host=host,
|
host=host,
|
||||||
port=port,
|
port=port,
|
||||||
routes={('GET', '/installed'): is_installed_api},
|
routes={('GET', '/installed'): is_installed_api},
|
||||||
use_websocket=True
|
|
||||||
)
|
)
|
||||||
sys.exit(ret)
|
sys.exit(ret)
|
||||||
|
|
||||||
|
|
||||||
def extensions():
|
|
||||||
# This is probably not used anywhere, but the actionsmap and code can be
|
|
||||||
# extended by creating such files that contain bits of actionmap...
|
|
||||||
return [f.split('/')[-1][:-4] for f in glob.glob("/usr/share/moulinette/actionsmap/ynh_*.yml")]
|
|
||||||
|
|
||||||
|
|
||||||
def check_command_is_valid_before_postinstall(args):
|
def check_command_is_valid_before_postinstall(args):
|
||||||
|
|
||||||
allowed_if_not_postinstalled = ['tools postinstall',
|
allowed_if_not_postinstalled = ['tools postinstall',
|
||||||
|
|
Loading…
Add table
Reference in a new issue