Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli][bug] catch uninstalled terraform errors properly #202

Merged
merged 1 commit into from
Jun 27, 2017

Conversation

ryandeivert
Copy link
Contributor

@ryandeivert ryandeivert commented Jun 26, 2017

to @jacknagz
cc @airbnb/streamalert-maintainers , @zbuc
resolves: #200
size: small

fix

  • Catching OSError when trying to run a command that does not exist. Previously, subprocess.CalledProcessError would not catch this because commands must exit cleanly with an error code for that exception to be caught. Commands that do not exist do not exit with an error code, and thus this was missed.
  • If the terraform_check fails to validate a TF install, we will now exit execution of the cli.

other changes

  • Fixing formatting issue with prerequisite message printed during terraform check (space missing between "to" and "your").

@@ -59,6 +59,9 @@ def run_command(runner_args, **kwargs):
except subprocess.CalledProcessError as err:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just catch a tuple of error types and use the same CLI message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jacknagz OSError does not have a cmd property - so we could, but we would lose some granularity. Doing it this way has the added bonus of knowing what command caused the OSError (see: runner_args[0])

Copy link
Contributor

@jacknagz jacknagz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 quick inline comment

@coveralls
Copy link

Coverage Status

Coverage remained the same at 79.307% when pulling fb0bfec on ryandeivert-bug-fix-200 into 68ace7f on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 79.307% when pulling 96014b5 on ryandeivert-bug-fix-200 into a9a7e3f on master.

@ryandeivert ryandeivert force-pushed the ryandeivert-bug-fix-200 branch from 96014b5 to b6ffa9e Compare June 27, 2017 02:58
@coveralls
Copy link

Coverage Status

Coverage remained the same at 79.307% when pulling b6ffa9e on ryandeivert-bug-fix-200 into a9a7e3f on master.

@ryandeivert ryandeivert merged commit 2abbcb3 into master Jun 27, 2017
@jacknagz jacknagz added the bug label Jul 6, 2017
@jacknagz jacknagz modified the milestone: 1.4.0 Jul 6, 2017
@jacknagz jacknagz changed the title [cli][bug] fixing bug related terraform not being installed. resolves #200 [cli][bug] catch uninstalled terraform errors properly Jul 6, 2017
@ryandeivert ryandeivert deleted the ryandeivert-bug-fix-200 branch July 12, 2017 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

insecure string pickle error
3 participants