mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Service app bugfix + refactoring
This commit is contained in:
parent
3e66f0359a
commit
7e612222e2
1 changed files with 29 additions and 21 deletions
|
@ -238,6 +238,8 @@ def app_install(app, domain, path='/', label=None, mode='private'):
|
||||||
if not lvl(manifest, 'yunohost', 'uid') or '__' in manifest['yunohost']['uid']:
|
if not lvl(manifest, 'yunohost', 'uid') or '__' in manifest['yunohost']['uid']:
|
||||||
raise YunoHostError(22, _("App uid is invalid"))
|
raise YunoHostError(22, _("App uid is invalid"))
|
||||||
|
|
||||||
|
is_web = lvl(manifest, 'yunohost', 'webapp')
|
||||||
|
|
||||||
instance_number = _installed_instance_number(manifest['yunohost']['uid']) + 1
|
instance_number = _installed_instance_number(manifest['yunohost']['uid']) + 1
|
||||||
if instance_number > 1:
|
if instance_number > 1:
|
||||||
if not lvl(manifest, 'yunohost', 'multi_instance') or not is_true(manifest['yunohost']['multi_instance']):
|
if not lvl(manifest, 'yunohost', 'multi_instance') or not is_true(manifest['yunohost']['multi_instance']):
|
||||||
|
@ -252,9 +254,11 @@ def app_install(app, domain, path='/', label=None, mode='private'):
|
||||||
'APP_ID': unique_app_id
|
'APP_ID': unique_app_id
|
||||||
}
|
}
|
||||||
|
|
||||||
if lvl(manifest, 'yunohost', 'webapp'):
|
if is_web:
|
||||||
script_var_dict['APP_DOMAIN'] = domain
|
script_var_dict.update({
|
||||||
script_var_dict['APP_PATH'] = path
|
'APP_DOMAIN': domain,
|
||||||
|
'APP_PATH': path
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
#########################################
|
#########################################
|
||||||
|
@ -291,7 +295,7 @@ def app_install(app, domain, path='/', label=None, mode='private'):
|
||||||
# Specifically configure lemon & apache #
|
# Specifically configure lemon & apache #
|
||||||
#########################################
|
#########################################
|
||||||
|
|
||||||
if lvl(manifest, 'yunohost', 'webapp'):
|
if is_web:
|
||||||
domain_add([domain], web=True)
|
domain_add([domain], web=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -341,7 +345,7 @@ def app_install(app, domain, path='/', label=None, mode='private'):
|
||||||
os.system('cp -a "'+ app_tmp_folder +'" "'+ app_final_path +'"')
|
os.system('cp -a "'+ app_tmp_folder +'" "'+ app_final_path +'"')
|
||||||
os.system('chown -R www-data: "'+ app_final_path +'"')
|
os.system('chown -R www-data: "'+ app_final_path +'"')
|
||||||
|
|
||||||
if lvl(manifest, 'yunohost', 'webapp'):
|
if is_web:
|
||||||
os.system('service apache2 reload')
|
os.system('service apache2 reload')
|
||||||
shutil.rmtree(app_final_path + manifest['yunohost']['script_path'])
|
shutil.rmtree(app_final_path + manifest['yunohost']['script_path'])
|
||||||
|
|
||||||
|
@ -356,7 +360,6 @@ def app_install(app, domain, path='/', label=None, mode='private'):
|
||||||
if os.path.exists(app_setting_path): shutil.rmtree(app_setting_path)
|
if os.path.exists(app_setting_path): shutil.rmtree(app_setting_path)
|
||||||
os.makedirs(app_setting_path)
|
os.makedirs(app_setting_path)
|
||||||
|
|
||||||
if lvl(manifest, 'yunohost', 'webapp'):
|
|
||||||
yaml_dict = {
|
yaml_dict = {
|
||||||
'uid' : manifest['yunohost']['uid'],
|
'uid' : manifest['yunohost']['uid'],
|
||||||
'instance' : instance_number,
|
'instance' : instance_number,
|
||||||
|
@ -364,13 +367,18 @@ def app_install(app, domain, path='/', label=None, mode='private'):
|
||||||
'install_time': int(time.time()),
|
'install_time': int(time.time()),
|
||||||
'name': manifest['name'],
|
'name': manifest['name'],
|
||||||
'mode': mode,
|
'mode': mode,
|
||||||
|
}
|
||||||
|
if is_web:
|
||||||
|
yaml_dict.update({
|
||||||
'domain': domain,
|
'domain': domain,
|
||||||
'path': path,
|
'path': path,
|
||||||
}
|
})
|
||||||
|
|
||||||
if lvl(manifest, 'yunohost', 'webapp', 'db'):
|
if lvl(manifest, 'yunohost', 'webapp', 'db'):
|
||||||
yaml_dict['db_pwd'] = db_pwd
|
yaml_dict.update({
|
||||||
yaml_dict['db_user'] = db_user
|
'db_pwd': db_pwd,
|
||||||
|
'db_user': db_user
|
||||||
|
})
|
||||||
if label: yaml_dict['label'] = label
|
if label: yaml_dict['label'] = label
|
||||||
else: yaml_dict['label'] = manifest['name']
|
else: yaml_dict['label'] = manifest['name']
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue