mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Change parse to action
This commit is contained in:
parent
c4bc8e2bce
commit
6a6f53b27d
1 changed files with 8 additions and 6 deletions
14
yunohost
14
yunohost
|
@ -211,15 +211,17 @@ def main():
|
||||||
int -- 0 or error code
|
int -- 0 or error code
|
||||||
|
|
||||||
"""
|
"""
|
||||||
parse = parse_dict(action_dict)
|
action = parse_dict(action_dict)
|
||||||
if parse['ldap']:
|
|
||||||
|
# Connect to LDAP if the action is requiring it
|
||||||
|
if action['ldap']:
|
||||||
yldap = YunoHostLDAP()
|
yldap = YunoHostLDAP()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if parse['ldap']:
|
if action['ldap']:
|
||||||
result = parse['args'].func(vars(parse['args']), yldap)
|
result = action['args'].func(vars(action['args']), yldap)
|
||||||
else:
|
else:
|
||||||
result = parse['args'].func(vars(parse['args']))
|
result = action['args'].func(vars(action['args']))
|
||||||
except YunoHostError, error:
|
except YunoHostError, error:
|
||||||
if not __debug__ :
|
if not __debug__ :
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
@ -234,7 +236,7 @@ def main():
|
||||||
else:
|
else:
|
||||||
print(json.dumps(result))
|
print(json.dumps(result))
|
||||||
finally:
|
finally:
|
||||||
if parse['ldap']:
|
if action['ldap']:
|
||||||
yldap.disconnect()
|
yldap.disconnect()
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in a new issue