Fix installation if TLS verification is skipped

The installation failed, if TLS verification was disabled and no CA
certificate was given in the configuration. This happened because the
installation script always expected the CA certificate.

The installation now only expects the certificate, if TLS verification
is enabled.

Change-Id: I5429fc1ee0d230c74cc0689607cf2736d6520030
This commit is contained in:
Thomas Draebing 2020-04-29 17:33:51 +02:00
parent d0b53a0970
commit dc60bd1654

View file

@ -96,8 +96,14 @@ def _create_promtail_configs(config, output_dir):
os.remove(os.path.join(output_dir, "promtail.yaml"))
with open(os.path.join(output_dir, "promtail", "promtail.ca.crt"), "w") as f:
f.write(config["tls"]["caCert"])
if not config["tls"]["skipVerify"]:
try:
with open(
os.path.join(output_dir, "promtail", "promtail.ca.crt"), "w"
) as f:
f.write(config["tls"]["caCert"])
except TypeError:
print("CA certificate for TLS verification has to be given.")
def _download_promtail(output_dir):