From afed939379a5870cbbdf3bcb4d0ce8a4ebd789a5 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Fri, 26 Jan 2018 21:32:07 +0100 Subject: generate_config: Check yaml arg is really a file In order to support bash process substition, e.g. $ ./generate_config.py -j /path/to/template.j2 -y <(echo stuff); do not consume the contents of ARGS.yaml unless it is a file. Change-Id: I89053cfaadc158f6a15f85836892b21980081772 Signed-off-by: Alexandru Avadanii --- config/utils/generate_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config') diff --git a/config/utils/generate_config.py b/config/utils/generate_config.py index 5dbdb7d1..b2b52f0b 100755 --- a/config/utils/generate_config.py +++ b/config/utils/generate_config.py @@ -65,7 +65,7 @@ ENV.filters['dpkg_arch'] = dpkg_arch # Run `eyaml decrypt` on the whole file, but only if PDF data is encrypted # Note: eyaml return code is 0 even if keys are not available try: - if 'ENC[PKCS7' in open(ARGS.yaml).read(): + if os.path.isfile(ARGS.yaml) and 'ENC[PKCS7' in open(ARGS.yaml).read(): DICT = yaml.safe_load(check_output(['eyaml', 'decrypt', '-f', ARGS.yaml])) except CalledProcessError as ex: -- cgit 1.2.3-korg