Skip to content

Commit 4b83694

Browse files
authored
Merge pull request #6 from Ajedi32/fix_remotedisconnected
Fix script failure when restarting Web GUI
2 parents bd76340 + a29cd1c commit 4b83694

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

deploy_freenas.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
else:
5252
print ("Error importing certificate!")
5353
print (r)
54-
sys.exit(1)
54+
sys.exit(1)
5555

5656
# Download certificate list
5757
limit = {'limit': 0} # set limit to 0 to disable paging in the event of many certificates
@@ -66,7 +66,7 @@
6666
print ("Error listing certificates!")
6767
print (r)
6868
sys.exit(1)
69-
69+
7070
# Parse certificate list to find the id that matches our cert name
7171
cert_list = r.json()
7272

@@ -84,7 +84,7 @@
8484
data=json.dumps({
8585
"stg_guicertificate": cert_id,
8686
}),
87-
)
87+
)
8888

8989
if r.status_code == 200:
9090
print ("Setting active certificate successful")
@@ -94,7 +94,10 @@
9494
sys.exit(1)
9595

9696
# Reload nginx with new cert
97-
r = requests.post(
98-
PROTOCOL + DOMAIN_NAME + '/api/v1.0/system/settings/restart-httpd-all/',
99-
auth=(USER, PASSWORD),
100-
)
97+
try:
98+
r = requests.post(
99+
PROTOCOL + DOMAIN_NAME + '/api/v1.0/system/settings/restart-httpd-all/',
100+
auth=(USER, PASSWORD),
101+
)
102+
except requests.exceptions.ConnectionError:
103+
pass # This is expected when restarting the web server

0 commit comments

Comments
 (0)