mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-25 15:10:38 +01:00
python handle script error
This commit is contained in:
parent
1fa3a9bf63
commit
c128be482d
2 changed files with 19 additions and 4 deletions
|
@ -87,6 +87,10 @@ def duckDNSupdate(domain, token, ip):
|
||||||
|
|
||||||
def subscriptionsNew(ip, dnsservice, id, token, target):
|
def subscriptionsNew(ip, dnsservice, id, token, target):
|
||||||
|
|
||||||
|
# id needs to the full domain name
|
||||||
|
if id.find(".") == -1:
|
||||||
|
raise BlitzError("not a fully qualified domainname", dnsservice_id)
|
||||||
|
|
||||||
# check if id already exists
|
# check if id already exists
|
||||||
if len(getSubscription(id)) > 0:
|
if len(getSubscription(id)) > 0:
|
||||||
raise BlitzError("id already exists", id)
|
raise BlitzError("id already exists", id)
|
||||||
|
@ -103,10 +107,11 @@ def subscriptionsNew(ip, dnsservice, id, token, target):
|
||||||
# update DNS with actual IP
|
# update DNS with actual IP
|
||||||
if dnsservice == "duckdns":
|
if dnsservice == "duckdns":
|
||||||
duckDNSupdate(getsubdomain(id), token, realip)
|
duckDNSupdate(getsubdomain(id), token, realip)
|
||||||
|
if [id]
|
||||||
|
|
||||||
# run the ACME script
|
# run the ACME script
|
||||||
acmeResult=subprocess.check_output(["/home/admin/config.scripts/bonus.letsencrypt.sh", "issue-cert", dnsservice, id, token, target])
|
acmeResult=subprocess.check_output(["/home/admin/config.scripts/bonus.letsencrypt.sh", "issue-cert", dnsservice, id, token, target])
|
||||||
if (acmeResult.find("error=") > -1):
|
if acmeResult not 0:
|
||||||
time.sleep(6)
|
time.sleep(6)
|
||||||
raise BlitzError("letsancrypt acme failed", acmeResult)
|
raise BlitzError("letsancrypt acme failed", acmeResult)
|
||||||
|
|
||||||
|
@ -163,7 +168,7 @@ def subscriptionsCancel(id):
|
||||||
# run the ACME script to remove cert
|
# run the ACME script to remove cert
|
||||||
if removedCert:
|
if removedCert:
|
||||||
acmeResult=subprocess.check_output(["/home/admin/config.scripts/bonus.letsencrypt.sh", "remove-cert", removedCert['id'], removedCert['target']])
|
acmeResult=subprocess.check_output(["/home/admin/config.scripts/bonus.letsencrypt.sh", "remove-cert", removedCert['id'], removedCert['target']])
|
||||||
if (acmeResult.find("error=") > -1):
|
if acmeResult not 0:
|
||||||
time.sleep(6)
|
time.sleep(6)
|
||||||
raise BlitzError("letsancrypt acme failed", acmeResult)
|
raise BlitzError("letsancrypt acme failed", acmeResult)
|
||||||
|
|
||||||
|
|
|
@ -148,8 +148,11 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||||
acme_install "${address}"
|
acme_install "${address}"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "*** Let's Encrypt Client 'acme.sh' appears to be installed already ***"
|
echo "# *** Let's Encrypt Client 'acme.sh' appears to be installed already ***"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###################
|
###################
|
||||||
|
@ -234,6 +237,8 @@ elif [ "$1" = "issue-cert" ]; then
|
||||||
echo "# restarting nginx"
|
echo "# restarting nginx"
|
||||||
sudo systemctl restart nginx 2>&1
|
sudo systemctl restart nginx 2>&1
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# REMOVE-CERT
|
# REMOVE-CERT
|
||||||
###################
|
###################
|
||||||
|
@ -300,6 +305,8 @@ elif [ "$1" = "remove-cert" ]; then
|
||||||
echo "# restarting nginx"
|
echo "# restarting nginx"
|
||||||
sudo systemctl restart nginx 2>&1
|
sudo systemctl restart nginx 2>&1
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# OFF
|
# OFF
|
||||||
###################
|
###################
|
||||||
|
@ -333,8 +340,11 @@ elif [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||||
echo "# restarting nginx"
|
echo "# restarting nginx"
|
||||||
sudo systemctl restart nginx 2>&1
|
sudo systemctl restart nginx 2>&1
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "*** Let's Encrypt Client 'acme.sh' not installed ***"
|
echo "# *** Let's Encrypt Client 'acme.sh' not installed ***"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue