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

Raise exception if no token is set when using the chef-automate fetcher #249

Merged
merged 1 commit into from
Jun 22, 2017

Conversation

adamleff
Copy link
Contributor

The chef-automate fetcher uses the data_collector token settings but does not check to ensure it's set before passing it to InSpec for Fetcher purposes. This causes InSpec to create a data-collector-token header with a nil value, and then Net::HTTP will toss an ugly error when trying to call #strip on nil.

InSpec should validate inputs too, but this will help catch this issue in the audit cookbook and provide a better error message. This was found in the Chef sales demo environments.

The chef-automate fetcher uses the data_collector token settings but
does not check to ensure it's set before passing it to InSpec for
Fetcher purposes. This causes InSpec to create a data-collector-token
header with a nil value, and then Net::HTTP will toss an ugly error
when trying to call `#strip` on nil.

InSpec should validate inputs too, but this will help catch this issue
in the audit cookbook and provide a better error message. This was
found in the Chef sales demo environments.

Signed-off-by: Adam Leff <adam@leff.co>
Copy link
Contributor

@chris-rock chris-rock left a comment

Choose a reason for hiding this comment

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

Thank you @adamleff

@adamleff adamleff merged commit c822a05 into master Jun 22, 2017
@adamleff adamleff deleted the adamleff/raise-on-nil-token branch June 22, 2017 00:07
@chris-rock chris-rock added the Type: Enhancement Adds new functionality. label Jul 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Adds new functionality.
Development

Successfully merging this pull request may close these issues.

2 participants