Fix error in python script extracting certs from the acme.json file if there are sections with null values as certs

Signed-off-by: Brandon Schmitt <Brandon.Schmitt@live.de>
This commit is contained in:
Brandon Schmitt 2020-12-06 20:29:12 +01:00
parent ec290acd1f
commit 6251f898ea
No known key found for this signature in database
GPG key ID: F34558B1EBBD662B
2 changed files with 16 additions and 10 deletions

View file

@ -56,6 +56,7 @@ import sys,json
acme = json.load(sys.stdin) acme = json.load(sys.stdin)
for key, value in acme.items(): for key, value in acme.items():
certs = value['Certificates'] certs = value['Certificates']
if certs is not None:
for cert in certs: for cert in certs:
if 'domain' in cert and 'key' in cert: if 'domain' in cert and 'key' in cert:
if 'main' in cert['domain'] and cert['domain']['main'] == '${1}' or 'sans' in cert['domain'] and '${1}' in cert['domain']['sans']: if 'main' in cert['domain'] and cert['domain']['main'] == '${1}' or 'sans' in cert['domain'] and '${1}' in cert['domain']['sans']:
@ -70,6 +71,7 @@ import sys,json
acme = json.load(sys.stdin) acme = json.load(sys.stdin)
for key, value in acme.items(): for key, value in acme.items():
certs = value['Certificates'] certs = value['Certificates']
if certs is not None:
for cert in certs: for cert in certs:
if 'domain' in cert and 'certificate' in cert: if 'domain' in cert and 'certificate' in cert:
if 'main' in cert['domain'] and cert['domain']['main'] == '${1}' or 'sans' in cert['domain'] and '${1}' in cert['domain']['sans']: if 'main' in cert['domain'] and cert['domain']['main'] == '${1}' or 'sans' in cert['domain'] and '${1}' in cert['domain']['sans']:

View file

@ -1,4 +1,8 @@
{ {
"empty": {
"Account": null,
"Certificates": null
},
"le": { "le": {
"Account": { "Account": {
"Email": "acme@admin.com", "Email": "acme@admin.com",