From 933b631739d50b3f4d1f3be86a117d7efe6f1693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Sat, 16 Feb 2019 01:11:30 +0100 Subject: [PATCH] fix handling no environement file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- ansible/terraform.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ansible/terraform.py b/ansible/terraform.py index 8d8d4f4..d945dfa 100755 --- a/ansible/terraform.py +++ b/ansible/terraform.py @@ -8,8 +8,11 @@ import sys def _tf_env(): # way to figure out currenly used TF workspace - with open(TERRAFORM_ENV) as f: - return f.read() + try: + with open(TERRAFORM_ENV) as f: + return f.read() + except: + return 'default' TERRAFORM_PATH = os.environ.get('ANSIBLE_TF_BIN', 'terraform') TERRAFORM_DIR = os.environ.get('ANSIBLE_TF_DIR', os.getcwd())