Skip to content

Commit

Permalink
Merge branch 'TER-391_cleanup_argparser' into 'master'
Browse files Browse the repository at this point in the history
TER-391: Keep `--pipe-plan{-command}` args only on subparsers

Closes TER-391

See merge request claranet/cloudnative/projects/terraform/tools/tfwrapper!35
  • Loading branch information
Shr3ps committed Jul 15, 2019
2 parents 3b1db46 + 7078eb3 commit 97dd40b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions bin/tfwrapper
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,9 @@ def run_terraform(action, wrapper_config):
pipe_plan = action == "plan" and wrapper_config.get('pipe_plan') and pipe_plan_command
stdout = pipe_plan and subprocess.PIPE or None
with subprocess.Popen(command, cwd=working_dir, env=cmd_env, shell=False, stdout=stdout) as process:
logger.debug('Execute command "{}"'.format(command))
if pipe_plan:
logger.debug('Piping command "{}"'.format(pipe_plan_command))
with subprocess.Popen(pipe_plan_command, cwd=working_dir, env=cmd_env,
shell=True, stdin=process.stdout) as pipe_process:
try:
Expand Down Expand Up @@ -790,13 +792,6 @@ def main():
parser.add_argument('-c', '--confdir',
help='Configuration directory. Used to detect the project root. Defaults to conf.',
default='conf')
parser.add_argument("-l", "--pipe-plan",
action='store_true', default=False,
help=("Pipe plan output to the command set in config"
" or passed in --pipe-plan-command argument (cat by default)."))
parser.add_argument("--pipe-plan-command",
action='store', nargs='?',
help="Pipe plan output to the command of your choice set as argument inline value.")
parser.add_argument('-a', '--account',
help='Target account. Autodetected if none is provided.',
nargs='?')
Expand Down

0 comments on commit 97dd40b

Please sign in to comment.