mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-05 13:14:46 +02:00
dockersetup: ensure letsencrypt volume change gets undone
If you enable the --letsencrypt option when you run dockersetup.py, the script will modify the volume mount for the certificates to point to /etc/letsencrypt instead of /opt/cert. If you then run dockersetup.py again (with -r/--reinstall) without --letsencrypt, we want the path to be set back to /opt/cert, so ensure that it does. Additionally, the code wasn't actually setting the path for the layerscertbot service since editing that section was done separately. (Admittedly, the letsencrypt functionality has not been well-tested.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
085447cecc
commit
5f81885a57
|
@ -249,6 +249,16 @@ def yaml_comment(line):
|
|||
|
||||
# Add hostname, secret key, db info, and email host in docker-compose.yml
|
||||
def edit_dockercompose(hostname, dbpassword, dbapassword, secretkey, rmqpassword, portmapping, letsencrypt, email_host, email_port, email_user, email_password, email_ssl, email_tls):
|
||||
|
||||
def adjust_cert_mount_line(ln):
|
||||
linesplit = ln.split(':')
|
||||
if letsencrypt:
|
||||
linesplit[1] = '/etc/letsencrypt'
|
||||
else:
|
||||
linesplit[1] = '/opt/cert'
|
||||
# This allows us to handle if there is a ":ro" or similar on the end
|
||||
return ':'.join(linesplit)
|
||||
|
||||
filedata= readfile("docker-compose.yml")
|
||||
in_layersweb = False
|
||||
in_layersweb_ports = False
|
||||
|
@ -276,6 +286,8 @@ def edit_dockercompose(hostname, dbpassword, dbapassword, secretkey, rmqpassword
|
|||
if len(format) <= len(in_layerscertbot_format):
|
||||
in_layerscertbot_format = False
|
||||
elif letsencrypt:
|
||||
if "./docker/certs:/" in ucline:
|
||||
ucline = adjust_cert_mount_line(ucline)
|
||||
newlines.append(ucline + '\n')
|
||||
continue
|
||||
else:
|
||||
|
@ -352,8 +364,8 @@ def edit_dockercompose(hostname, dbpassword, dbapassword, secretkey, rmqpassword
|
|||
if in_layersweb:
|
||||
in_layersweb_ports = True
|
||||
newlines.append(line + "\n")
|
||||
elif letsencrypt and "./docker/certs:/" in line:
|
||||
newlines.append(line.split(':')[0] + ':/etc/letsencrypt\n')
|
||||
elif "./docker/certs:/" in line:
|
||||
newlines.append(adjust_cert_mount_line(line) + '\n')
|
||||
else:
|
||||
newlines.append(line + "\n")
|
||||
writefile("docker-compose.yml", ''.join(newlines))
|
||||
|
|
Loading…
Reference in New Issue
Block a user