mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge cdaceb52b8
into ec590bdef8
This commit is contained in:
commit
249ca7671c
1 changed files with 22 additions and 5 deletions
|
@ -155,8 +155,12 @@ def app_list(offset=None, limit=None, filter=None, raw=False):
|
|||
|
||||
for applist in applists:
|
||||
if '.json' in applist:
|
||||
list_name=applist.split('.json', 1)[0]
|
||||
with open(repo_path +'/'+ applist) as json_list:
|
||||
app_dict.update(json.loads(str(json_list.read())))
|
||||
list_content=json.loads(str(json_list.read()))
|
||||
for k in list_content.keys():
|
||||
list_content[k]['store']=list_name
|
||||
app_dict.update(list_content)
|
||||
|
||||
for app in os.listdir(apps_setting_path):
|
||||
if app not in app_dict:
|
||||
|
@ -482,7 +486,10 @@ def app_install(auth, app, label=None, args=None):
|
|||
hook_add(app_id, app_tmp_folder +'/hooks/'+ file)
|
||||
|
||||
now = int(time.time())
|
||||
app_setting(app_id, 'id', app_id)
|
||||
|
||||
# We can't use app_setting cause it creates an 'app_not_correctly_installed'
|
||||
# message. See https://dev.yunohost.org/issues/206#note-3
|
||||
_set_app_settings(app, {'id':app_id})
|
||||
# TODO: Move install_time away from app_setting
|
||||
app_setting(app_id, 'install_time', now)
|
||||
status['installed_at'] = now
|
||||
|
@ -803,9 +810,7 @@ def app_setting(app, key, value=None, delete=False):
|
|||
value=yaml.load(value)
|
||||
app_settings[key] = value
|
||||
|
||||
with open(os.path.join(
|
||||
apps_setting_path, app, 'settings.yml'), 'w') as f:
|
||||
yaml.safe_dump(app_settings, f, default_flow_style=False)
|
||||
_set_app_settings(app, app_settings)
|
||||
|
||||
|
||||
def app_checkport(port):
|
||||
|
@ -1026,6 +1031,18 @@ def _get_app_settings(app_id):
|
|||
app=app_id))
|
||||
return {}
|
||||
|
||||
def _set_app_settings(app_id, app_settings):
|
||||
"""
|
||||
Set settings of an app
|
||||
|
||||
Keyword arguments:
|
||||
app_id -- The app id
|
||||
app_settings -- A dictionary of app settings
|
||||
|
||||
"""
|
||||
with open(os.path.join(
|
||||
apps_setting_path, app_id, 'settings.yml'), 'w') as f:
|
||||
yaml.safe_dump(app_settings, f, default_flow_style=False)
|
||||
|
||||
def _get_app_status(app_id, format_date=False):
|
||||
"""
|
||||
|
|
Loading…
Add table
Reference in a new issue