mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
yunohost tools postinstall
auto-detect DynDNS domains
and asks for a --subscribe or --no-subscribe option
This commit is contained in:
parent
7117c61bbf
commit
bc3521fd04
2 changed files with 20 additions and 12 deletions
|
@ -1574,9 +1574,19 @@ tools:
|
|||
pattern: *pattern_password
|
||||
required: True
|
||||
comment: good_practices_about_admin_password
|
||||
--ignore-dyndns:
|
||||
help: Do not subscribe domain to a DynDNS service
|
||||
-n:
|
||||
full: --no-subscribe
|
||||
help: If adding a DynDNS domain, only add the domain, without subscribing to the DynDNS service
|
||||
action: store_true
|
||||
-s:
|
||||
full: --subscribe
|
||||
metavar: PASSWORD
|
||||
nargs: "?"
|
||||
const: 0
|
||||
help: If adding a DynDNS domain, subscribe to the DynDNS service with a password, used to later delete the domain
|
||||
extra:
|
||||
pattern: *pattern_password
|
||||
comment: dyndns_added_password
|
||||
--force-password:
|
||||
help: Use this if you really want to set a weak password
|
||||
action: store_true
|
||||
|
|
18
src/tools.py
18
src/tools.py
|
@ -186,6 +186,8 @@ def tools_postinstall(
|
|||
domain,
|
||||
password,
|
||||
ignore_dyndns=False,
|
||||
subscribe=None,
|
||||
no_subscribe=False,
|
||||
force_password=False,
|
||||
force_diskspace=False,
|
||||
):
|
||||
|
@ -230,10 +232,13 @@ def tools_postinstall(
|
|||
assert_password_is_strong_enough("admin", password)
|
||||
|
||||
# If this is a nohost.me/noho.st, actually check for availability
|
||||
if not ignore_dyndns and is_yunohost_dyndns_domain(domain):
|
||||
if is_yunohost_dyndns_domain(domain):
|
||||
if ((subscribe==None) == (no_subscribe==False)):
|
||||
raise YunohostValidationError("domain_dyndns_instruction_unclear")
|
||||
|
||||
# Check if the domain is available...
|
||||
try:
|
||||
available = _dyndns_available(domain)
|
||||
_dyndns_available(domain)
|
||||
# If an exception is thrown, most likely we don't have internet
|
||||
# connectivity or something. Assume that this domain isn't manageable
|
||||
# and inform the user that we could not contact the dyndns host server.
|
||||
|
@ -241,14 +246,7 @@ def tools_postinstall(
|
|||
logger.warning(
|
||||
m18n.n("dyndns_provider_unreachable", provider="dyndns.yunohost.org")
|
||||
)
|
||||
|
||||
if available:
|
||||
dyndns = True
|
||||
# If not, abort the postinstall
|
||||
else:
|
||||
raise YunohostValidationError("dyndns_unavailable", domain=domain)
|
||||
else:
|
||||
dyndns = False
|
||||
|
||||
if os.system("iptables -V >/dev/null 2>/dev/null") != 0:
|
||||
raise YunohostValidationError(
|
||||
|
@ -260,7 +258,7 @@ def tools_postinstall(
|
|||
logger.info(m18n.n("yunohost_installing"))
|
||||
|
||||
# New domain config
|
||||
domain_add(domain, dyndns)
|
||||
domain_add(domain, subscribe=subscribe,no_subscribe=no_subscribe)
|
||||
domain_main_domain(domain)
|
||||
|
||||
# Update LDAP admin and create home dir
|
||||
|
|
Loading…
Add table
Reference in a new issue