Fix missing secret error message

Add a warning message when the secret file doesn't exist

Fixes #5920

Signed-off-by: Marian Gappa <marian.gappa@gmail.com>
This commit is contained in:
Marian Gappa 2018-08-10 00:06:47 +02:00 committed by Ulysses Souza
parent 1566930a70
commit b9092cacdb

View File

@ -6,6 +6,7 @@ import logging
import operator
import re
from functools import reduce
from os import path
import enum
import six
@ -807,7 +808,15 @@ def get_secrets(service, service_secrets, secret_defs):
)
)
secrets.append({'secret': secret, 'file': secret_def.get('file')})
secret_file = secret_def.get('file')
if not path.isfile(str(secret_file)):
log.warn(
"Service \"{service}\" uses an undefined secret file \"{secret_file}\", "
"the following folder is created \"{secret_file}\"".format(
service=service, secret_file=secret_file
)
)
secrets.append({'secret': secret, 'file': secret_file})
return secrets