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

Add automate reporter #2902

Merged
merged 3 commits into from
Apr 5, 2018
Merged

Add automate reporter #2902

merged 3 commits into from
Apr 5, 2018

Conversation

jquick
Copy link
Contributor

@jquick jquick commented Mar 30, 2018

Adds the automate reporter to send directly to automate. Currently this report is only usable via the --json-config as it requires additional metadata.

Fixes #2547

Signed-off-by: Jared Quick jquick@chef.io

@jquick jquick requested a review from a team as a code owner March 30, 2018 13:04
@jquick jquick force-pushed the jq/automate_reporter branch 2 times, most recently from 2d89d30 to fe38949 Compare March 30, 2018 19:15
Signed-off-by: Jared Quick <jquick@chef.io>
@jquick jquick force-pushed the jq/automate_reporter branch from fe38949 to 644ac27 Compare April 2, 2018 15:42
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.

Short and simple 👍 Thank you @jquick

# This hashes the passed string into SHA1.
# Then it downgrades the 160bit SHA1 to a 128bit
# then we format it as a valid UUIDv5.
def uuid_from_string(string)
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting idea 👍

Net::HTTP.start(uri.hostname,
uri.port,
use_ssl: uri.scheme == 'https',
verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
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 make this a config option? I would like to go to a world where we verify it

Signed-off-by: Jared Quick <jquick@chef.io>
@jquick jquick force-pushed the jq/automate_reporter branch from 5b8f9f9 to 90c5d2a Compare April 4, 2018 17:38
super(config)

# default to using no ssl for sending reports
@config['use_ssl'] = @config['use_ssl'] || false
Copy link
Contributor

Choose a reason for hiding this comment

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

Would @config['use_ssl'] ||= false work here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think use_ssl is not precise, because we use ssl in any case. The only difference is that in one case we validate the certificate and in the other we don't. Maybe @config['verify_ssl'] = @config['verify_ssl'] || false

Copy link
Contributor

@jerryaldrichiii jerryaldrichiii left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks @jquick

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.

Great work @jquick

@backend.platform[field]
rescue Train::Error => e
Inspec::Log.error(e.message)
nil
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should document, why it is okay to ignore the error here

super(config)

# default to using no ssl for sending reports
@config['use_ssl'] = @config['use_ssl'] || false
Copy link
Contributor

Choose a reason for hiding this comment

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

I think use_ssl is not precise, because we use ssl in any case. The only difference is that in one case we validate the certificate and in the other we don't. Maybe @config['verify_ssl'] = @config['verify_ssl'] || false

Signed-off-by: Jared Quick <jquick@chef.io>
@jquick jquick merged commit b246cf7 into master Apr 5, 2018
@jquick jquick deleted the jq/automate_reporter branch April 5, 2018 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants