mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Use _get_maindomain helper.
This commit is contained in:
parent
0c01dd4dca
commit
6df7a896ef
4 changed files with 8 additions and 13 deletions
|
@ -988,12 +988,10 @@ def app_ssowatconf(auth):
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from yunohost.domain import domain_list
|
from yunohost.domain import domain_list, _get_maindomain
|
||||||
from yunohost.user import user_list
|
from yunohost.user import user_list
|
||||||
|
|
||||||
with open('/etc/yunohost/current_host', 'r') as f:
|
main_domain = _get_maindomain()
|
||||||
main_domain = f.readline().rstrip()
|
|
||||||
|
|
||||||
domains = domain_list(auth)['domains']
|
domains = domain_list(auth)['domains']
|
||||||
|
|
||||||
users = {}
|
users = {}
|
||||||
|
|
|
@ -35,7 +35,7 @@ import subprocess
|
||||||
from moulinette.core import MoulinetteError
|
from moulinette.core import MoulinetteError
|
||||||
from moulinette.utils.log import getActionLogger
|
from moulinette.utils.log import getActionLogger
|
||||||
|
|
||||||
from yunohost.domain import get_public_ip
|
from yunohost.domain import get_public_ip, _get_maindomain
|
||||||
|
|
||||||
logger = getActionLogger('yunohost.dyndns')
|
logger = getActionLogger('yunohost.dyndns')
|
||||||
|
|
||||||
|
@ -78,8 +78,7 @@ def dyndns_subscribe(subscribe_host="dyndns.yunohost.org", domain=None, key=None
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if domain is None:
|
if domain is None:
|
||||||
with open('/etc/yunohost/current_host', 'r') as f:
|
domain = _get_maindomain()
|
||||||
domain = f.readline().rstrip()
|
|
||||||
|
|
||||||
# Verify if domain is available
|
# Verify if domain is available
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -40,7 +40,7 @@ from datetime import datetime
|
||||||
from moulinette.core import MoulinetteError
|
from moulinette.core import MoulinetteError
|
||||||
from moulinette.utils.log import getActionLogger
|
from moulinette.utils.log import getActionLogger
|
||||||
|
|
||||||
from yunohost.domain import get_public_ip
|
from yunohost.domain import get_public_ip, _get_maindomain
|
||||||
|
|
||||||
logger = getActionLogger('yunohost.monitor')
|
logger = getActionLogger('yunohost.monitor')
|
||||||
|
|
||||||
|
@ -174,8 +174,7 @@ def monitor_network(units=None, human_readable=False):
|
||||||
for u in units:
|
for u in units:
|
||||||
if u == 'check':
|
if u == 'check':
|
||||||
result[u] = {}
|
result[u] = {}
|
||||||
with open('/etc/yunohost/current_host', 'r') as f:
|
domain = _get_maindomain()
|
||||||
domain = f.readline().rstrip()
|
|
||||||
cmd_check_smtp = os.system('/bin/nc -z -w1 yunohost.org 25')
|
cmd_check_smtp = os.system('/bin/nc -z -w1 yunohost.org 25')
|
||||||
if cmd_check_smtp == 0:
|
if cmd_check_smtp == 0:
|
||||||
smtp_check = m18n.n('network_check_smtp_ok')
|
smtp_check = m18n.n('network_check_smtp_ok')
|
||||||
|
|
|
@ -106,7 +106,7 @@ def user_create(auth, username, firstname, lastname, mail, password,
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import pwd
|
import pwd
|
||||||
from yunohost.domain import domain_list
|
from yunohost.domain import domain_list, _get_maindomain
|
||||||
from yunohost.hook import hook_callback
|
from yunohost.hook import hook_callback
|
||||||
from yunohost.app import app_ssowatconf
|
from yunohost.app import app_ssowatconf
|
||||||
|
|
||||||
|
@ -163,8 +163,7 @@ def user_create(auth, username, firstname, lastname, mail, password,
|
||||||
|
|
||||||
# If it is the first user, add some aliases
|
# If it is the first user, add some aliases
|
||||||
if not auth.search(base='ou=users,dc=yunohost,dc=org', filter='uid=*'):
|
if not auth.search(base='ou=users,dc=yunohost,dc=org', filter='uid=*'):
|
||||||
with open('/etc/yunohost/current_host') as f:
|
main_domain = _get_maindomain()
|
||||||
main_domain = f.readline().rstrip()
|
|
||||||
aliases = [
|
aliases = [
|
||||||
'root@' + main_domain,
|
'root@' + main_domain,
|
||||||
'admin@' + main_domain,
|
'admin@' + main_domain,
|
||||||
|
|
Loading…
Add table
Reference in a new issue