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
7
app.py
7
app.py
|
@ -726,7 +726,7 @@ def app_setting(app, key, value=None, delete=False):
|
||||||
if value is None and not delete:
|
if value is None and not delete:
|
||||||
# Get the value
|
# Get the value
|
||||||
if app_settings is not None and key in app_settings:
|
if app_settings is not None and key in app_settings:
|
||||||
print(app_settings[key])
|
return app_settings[key]
|
||||||
else:
|
else:
|
||||||
# Set the value
|
# Set the value
|
||||||
if app_settings is None:
|
if app_settings is None:
|
||||||
|
@ -821,7 +821,6 @@ def app_initdb(user, password=None, db=None, sql=None):
|
||||||
if password is None:
|
if password is None:
|
||||||
password = random_password(12)
|
password = random_password(12)
|
||||||
return_pwd = True
|
return_pwd = True
|
||||||
print(password)
|
|
||||||
|
|
||||||
mysql_root_pwd = open('/etc/yunohost/mysql').read().rstrip()
|
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)
|
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,7 +830,9 @@ 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:
|
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'))
|
raise MoulinetteError(errno.EIO, m18n.n('mysql_db_init_failed'))
|
||||||
|
|
||||||
if not return_pwd:
|
if return_pwd:
|
||||||
|
return password
|
||||||
|
|
||||||
msignals.display(m18n.n('mysql_db_initialized'), 'success')
|
msignals.display(m18n.n('mysql_db_initialized'), 'success')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,11 @@ def dyndns_subscribe(subscribe_host="dyndns.yunohost.org", domain=None, key=None
|
||||||
if key is None:
|
if key is None:
|
||||||
if len(glob.glob('/etc/yunohost/dyndns/*.key')) == 0:
|
if len(glob.glob('/etc/yunohost/dyndns/*.key')) == 0:
|
||||||
os.makedirs('/etc/yunohost/dyndns')
|
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')
|
os.system('chmod 600 /etc/yunohost/dyndns/*.key /etc/yunohost/dyndns/*.private')
|
||||||
|
|
||||||
key_file = glob.glob('/etc/yunohost/dyndns/*.key')[0]
|
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)
|
except OSError: os.makedirs(hook_folder + action)
|
||||||
|
|
||||||
finalpath = hook_folder + action +'/'+ priority +'-'+ app
|
finalpath = hook_folder + action +'/'+ priority +'-'+ app
|
||||||
print app
|
|
||||||
os.system('cp %s %s' % (file, finalpath))
|
os.system('cp %s %s' % (file, finalpath))
|
||||||
os.system('chown -hR admin: %s' % hook_folder)
|
os.system('chown -hR admin: %s' % hook_folder)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue