mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Always return value instead of printing it
This commit is contained in:
parent
0074e34fad
commit
d8c5121010
3 changed files with 10 additions and 7 deletions
9
app.py
9
app.py
|
@ -726,7 +726,7 @@ def app_setting(app, key, value=None, delete=False):
|
|||
if value is None and not delete:
|
||||
# Get the value
|
||||
if app_settings is not None and key in app_settings:
|
||||
print(app_settings[key])
|
||||
return app_settings[key]
|
||||
else:
|
||||
# Set the value
|
||||
if app_settings is None:
|
||||
|
@ -821,7 +821,6 @@ def app_initdb(user, password=None, db=None, sql=None):
|
|||
if password is None:
|
||||
password = random_password(12)
|
||||
return_pwd = True
|
||||
print(password)
|
||||
|
||||
mysql_root_pwd = open('/etc/yunohost/mysql').read().rstrip()
|
||||
mysql_command = 'mysql -u root -p%s -e "CREATE DATABASE %s ; GRANT ALL PRIVILEGES ON %s.* TO \'%s\'@localhost IDENTIFIED BY \'%s\';"' % (mysql_root_pwd, db, db, user, password)
|
||||
|
@ -831,8 +830,10 @@ def app_initdb(user, password=None, db=None, sql=None):
|
|||
if os.system('mysql -u %s -p%s %s < %s' % (user, password, db, sql)) != 0:
|
||||
raise MoulinetteError(errno.EIO, m18n.n('mysql_db_init_failed'))
|
||||
|
||||
if not return_pwd:
|
||||
msignals.display(m18n.n('mysql_db_initialized'), 'success')
|
||||
if return_pwd:
|
||||
return password
|
||||
|
||||
msignals.display(m18n.n('mysql_db_initialized'), 'success')
|
||||
|
||||
|
||||
def app_ssowatconf(auth):
|
||||
|
|
|
@ -58,8 +58,11 @@ def dyndns_subscribe(subscribe_host="dyndns.yunohost.org", domain=None, key=None
|
|||
if key is None:
|
||||
if len(glob.glob('/etc/yunohost/dyndns/*.key')) == 0:
|
||||
os.makedirs('/etc/yunohost/dyndns')
|
||||
print(m18n.n('dyndns_key_generating'))
|
||||
os.system('cd /etc/yunohost/dyndns && dnssec-keygen -a hmac-md5 -b 128 -n USER %s' % domain)
|
||||
|
||||
msignals.display(m18n.n('dyndns_key_generating'))
|
||||
|
||||
os.system('cd /etc/yunohost/dyndns && ' \
|
||||
'dnssec-keygen -a hmac-md5 -b 128 -n USER %s' % domain)
|
||||
os.system('chmod 600 /etc/yunohost/dyndns/*.key /etc/yunohost/dyndns/*.private')
|
||||
|
||||
key_file = glob.glob('/etc/yunohost/dyndns/*.key')[0]
|
||||
|
|
1
hook.py
1
hook.py
|
@ -54,7 +54,6 @@ def hook_add(app, file):
|
|||
except OSError: os.makedirs(hook_folder + action)
|
||||
|
||||
finalpath = hook_folder + action +'/'+ priority +'-'+ app
|
||||
print app
|
||||
os.system('cp %s %s' % (file, finalpath))
|
||||
os.system('chown -hR admin: %s' % hook_folder)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue