Merge pull request #105 from YunoHost/app_debug

App debug
This commit is contained in:
Le Kload 2015-10-04 01:14:20 +02:00
commit b133d13469
2 changed files with 33 additions and 0 deletions

View file

@ -505,6 +505,14 @@ app:
full: --sql
help: Initial SQL file
### app_debug()
debug:
action_help: Display all debug informations for an application
api: GET /apps/<app>/debug
arguments:
app:
help: App name
### app_makedefault()
makedefault:
action_help: Redirect domain root to an app

View file

@ -39,6 +39,8 @@ import subprocess
from moulinette.core import MoulinetteError
from moulinette.utils.log import getActionLogger
from .service import service_log
logger = getActionLogger('yunohost.app')
repo_path = '/var/cache/yunohost/repo'
@ -722,6 +724,29 @@ def app_clearaccess(auth, apps):
app_ssowatconf(auth)
def app_debug(app):
"""
Display debug informations for an app
Keyword argument:
app
"""
with open(apps_setting_path + app + '/manifest.json') as f:
manifest = json.loads(f.read())
return {
'name': manifest['id'],
'label': manifest['name'],
'services': [{
"name": x,
"logs": [{
"file_name": y,
"file_content": "\n".join(z),
} for (y, z) in sorted(service_log(x).items(), key=lambda x: x[0])],
} for x in sorted(manifest.get("services", []))]
}
def app_makedefault(auth, app, domain=None):
"""
Redirect domain root to an app