mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Fix route registering
This commit is contained in:
parent
d9d7d0ef24
commit
8f12b330b0
1 changed files with 24 additions and 32 deletions
16
yunohost.tac
16
yunohost.tac
|
@ -117,6 +117,10 @@ def http_exec(request, **kwargs):
|
|||
raise YunoHostError(1, _("A YunoHost command is already running"))
|
||||
except IOError:
|
||||
if dict['function'].split('.')[1] != 'tools_postinstall':
|
||||
try:
|
||||
with open('/etc/yunohost/installed'): pass
|
||||
except IOError:
|
||||
raise YunoHostError(1, _("You must run postinstall before any other actions"))
|
||||
with open('/var/run/yunohost.pid', 'w') as f:
|
||||
f.write('ldap')
|
||||
os.system('chmod 400 /var/run/yunohost.pid')
|
||||
|
@ -212,18 +216,6 @@ def main():
|
|||
action_map = yaml.load(f)
|
||||
|
||||
# Register only postinstall action if YunoHost isn't completely set up
|
||||
try:
|
||||
with open('/etc/yunohost/installed') as f: pass
|
||||
except IOError:
|
||||
installed = False
|
||||
api.register('POST', '/postinstall', http_exec)
|
||||
api.register('OPTIONS', '/postinstall', http_exec)
|
||||
action_dict['POST /postinstall'] = {
|
||||
'function' : 'yunohost_tools.tools_postinstall',
|
||||
'help' : 'Execute post-install',
|
||||
'arguments' : action_map['tools']['actions']['postinstall']['arguments']
|
||||
}
|
||||
else:
|
||||
del action_map['general_arguments']
|
||||
for category, category_params in action_map.items():
|
||||
api.register('ALL', '/api/'+ category, api_doc)
|
||||
|
|
Loading…
Add table
Reference in a new issue