make workspaces configurable

This commit is contained in:
jem 2020-03-04 09:24:17 +01:00
parent f8dd897158
commit ac9c4ab104
2 changed files with 11 additions and 7 deletions

View file

@ -27,7 +27,7 @@ use_plugin("python.distutils")
default_task = "publish"
name = "ddadevops"
version = "0.4.0.dev10"
version = "0.4.0.dev12"
summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud"
description = __doc__
authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")]

View file

@ -10,13 +10,15 @@ def create_devops_terraform_build_config(stage, project_root_path, build_commons
account_name, additional_vars,
build_dir_name='target',
terraform_build_commons_dir_name='terraform',
output_json_name='output.json'):
output_json_name='output.json',
use_workspace=True):
ret = create_devops_build_config(
stage, project_root_path, build_commons_path, module, build_dir_name)
ret.update({'account_name': account_name,
'additional_vars': additional_vars,
'terraform_build_commons_dir_name': terraform_build_commons_dir_name,
'output_json_name': output_json_name})
'output_json_name': output_json_name,
'use_workspace': use_workspace})
return ret
@ -27,6 +29,7 @@ class DevopsTerraformBuild(DevopsBuild):
self.additional_vars = config['additional_vars']
self.terraform_build_commons_dir_name = config['terraform_build_commons_dir_name']
self.output_json_name = config['output_json_name']
self.use_workspace = config['use_workspace']
def terraform_build_commons_path(self):
mylist = [self.build_commons_path,
@ -52,6 +55,7 @@ class DevopsTerraformBuild(DevopsBuild):
def init_client(self):
tf = Terraform(working_dir=self.build_path())
tf.init()
if self.use_workspace:
try:
tf.workspace('select', slef.stage)
except: