fix plan's exitcode 2

This commit is contained in:
jem 2020-04-10 09:38:43 +02:00
parent 40e695a5da
commit bc4375d999
2 changed files with 24 additions and 24 deletions

View file

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

View file

@ -44,28 +44,28 @@ class WorkaroundTerraform(Terraform):
var_file, terraform_bin_path, is_env_vars_included) var_file, terraform_bin_path, is_env_vars_included)
self.latest_cmd = '' self.latest_cmd = ''
def apply(self, dir_or_plan=None, input=False, skip_plan=False, no_color=IsFlagged, # def apply(self, dir_or_plan=None, input=False, skip_plan=False, no_color=IsFlagged,
**kwargs): # **kwargs):
""" # """
refer to https://terraform.io/docs/commands/apply.html # refer to https://terraform.io/docs/commands/apply.html
no-color is flagged by default # no-color is flagged by default
:param no_color: disable color of stdout # :param no_color: disable color of stdout
:param input: disable prompt for a missing variable # :param input: disable prompt for a missing variable
:param dir_or_plan: folder relative to working folder # :param dir_or_plan: folder relative to working folder
:param skip_plan: force apply without plan (default: false) # :param skip_plan: force apply without plan (default: false)
:param kwargs: same as kwags in method 'cmd' # :param kwargs: same as kwags in method 'cmd'
:returns return_code, stdout, stderr # :returns return_code, stdout, stderr
""" # """
default = kwargs # default = kwargs
default['input'] = input # default['input'] = input
default['no_color'] = no_color # default['no_color'] = no_color
if skip_plan: # if skip_plan:
default['auto-approve'] = IsFlagged # default['auto-approve'] = IsFlagged
else: # else:
default['auto-approve'] = None # default['auto-approve'] = None
option_dict = self._generate_default_options(default) # option_dict = self._generate_default_options(default)
args = self._generate_default_args(dir_or_plan) # args = self._generate_default_args(dir_or_plan)
return self.cmd('apply', *args, **option_dict) # return self.cmd('apply', *args, **option_dict)
def generate_cmd_string(self, cmd, *args, **kwargs): def generate_cmd_string(self, cmd, *args, **kwargs):
result = super().generate_cmd_string(cmd, *args, **kwargs) result = super().generate_cmd_string(cmd, *args, **kwargs)
@ -149,7 +149,7 @@ class DevopsTerraformBuild(DevopsBuild):
def plan(self): def plan(self):
tf = self.init_client() tf = self.init_client()
tf.plan(capture_output=False, raise_on_error=True, tf.plan(capture_output=False, raise_on_error=False,
var=self.project_vars(), var=self.project_vars(),
var_file=self.additional_tfvar_files) var_file=self.additional_tfvar_files)
self.print_terraform_command(tf) self.print_terraform_command(tf)