From b6ffa9ea543b68fd79e7031db5b588b30e125e1b Mon Sep 17 00:00:00 2001 From: Ryan Deivert Date: Mon, 26 Jun 2017 13:57:25 -0700 Subject: [PATCH] [cli][bug] fixing bug related terraform not being installed. resolves issue #200 --- stream_alert_cli/helpers.py | 3 +++ stream_alert_cli/runner.py | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/stream_alert_cli/helpers.py b/stream_alert_cli/helpers.py index 6bdb7eb26..cc99f1a92 100644 --- a/stream_alert_cli/helpers.py +++ b/stream_alert_cli/helpers.py @@ -59,6 +59,9 @@ def run_command(runner_args, **kwargs): except subprocess.CalledProcessError as err: LOGGER_CLI.error('%s\n%s', error_message, err.cmd) return False + except OSError as err: + LOGGER_CLI.error('%s\n%s (%s)', error_message, err.strerror, runner_args[0]) + return False return True diff --git a/stream_alert_cli/runner.py b/stream_alert_cli/runner.py index c2b4001f1..97c982c04 100644 --- a/stream_alert_cli/runner.py +++ b/stream_alert_cli/runner.py @@ -84,9 +84,9 @@ def lambda_handler(options): def terraform_check(): """Verify that Terraform is configured correctly""" - prereqs_message = ('Terraform not found! Please install and add to' + prereqs_message = ('Terraform not found! Please install and add to ' 'your $PATH:\n' - '$ export PATH=$PATH:/usr/local/terraform/bin') + '\t$ export PATH=$PATH:/usr/local/terraform/bin') run_command(['terraform', 'version'], error_message=prereqs_message, quiet=True) @@ -95,7 +95,8 @@ def terraform_check(): def terraform_handler(options): """Handle all Terraform CLI operations""" # verify terraform is installed - terraform_check() + if not terraform_check(): + return # use a named tuple to match the 'processor' attribute in the argparse options deploy_opts = namedtuple('DeployOptions', ['processor'])