summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2017-12-09 01:10:32 +0100
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2017-12-15 18:11:20 +0000
commit39fce9a9a2b9197577692072c5f030877c9fc90e (patch)
tree935be5ec2bd0ab99b5e1042cfc096485529888cc
parent198e4d5d6514c7e6de4bafde75109ede5662b596 (diff)
generate_config.py: Fix running without eyaml
If eyaml is not installed or misconfigured, we should output raw encrypted data and throw a warn/error accordingly, instead of bailing out completely. Needed for Fuel deploys on PODs that do not use PDF encryption, e.g. lf-pod2. Change-Id: I2905df11a3cf2f2eb1ab9bfd8bd88619af2cab04 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> (cherry picked from commit 2db1004f456f4ed956246bc85049a69b39e8cab2)
-rwxr-xr-xconfig/utils/generate_config.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/config/utils/generate_config.py b/config/utils/generate_config.py
index ba4192cb..37108808 100755
--- a/config/utils/generate_config.py
+++ b/config/utils/generate_config.py
@@ -57,9 +57,13 @@ ENV.filters['dpkg_arch'] = dpkg_arch
try:
DICT = yaml.safe_load(check_output(['eyaml', 'decrypt', '-f', ARGS.yaml]))
except CalledProcessError as ex:
- pass
-if not DICT:
- logging.warn('PDF decryption failed, fallback to using raw data.')
+ logging.error('eyaml decryption failed, keys might be missing')
+except OSError as ex:
+ logging.warn('eyaml not found, skipping decryption')
+try:
+ DICT
+except NameError as ex:
+ logging.warn('PDF decryption skipped, fallback to using raw data.')
with open(ARGS.yaml) as _:
DICT = yaml.safe_load(_)