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

mssql_session resource: add port parameter #2429

Merged
merged 14 commits into from
Jan 16, 2018
Merged

mssql_session resource: add port parameter #2429

merged 14 commits into from
Jan 16, 2018

Conversation

tarcinil
Copy link
Contributor

fixes #2148

also adds unit testing around hostname/port/instance and mocks them to the same mssql-getdata in helper.rb

adds integration test for mssql_session based on appveyor services (https://www.appveyor.com/docs/services-databases/#sql-server-2012), however, no integration testing is done on appveyor so I removed the appveyor.yml services section in c28deda

Signed-off-by: Vern Burton <me@vernburton.com>
Signed-off-by: Vern Burton <me@vernburton.com>
…ource_fail

Signed-off-by: Vern Burton <me@vernburton.com>
Signed-off-by: Vern Burton <me@vernburton.com>
… to a dedicated port test

Signed-off-by: Vern Burton <me@vernburton.com>
Signed-off-by: Vern Burton <me@vernburton.com>
…ng so it would be a waste of time to enable it

Signed-off-by: Vern Burton <me@vernburton.com>
Signed-off-by: Vern Burton <me@vernburton.com>
Signed-off-by: Vern Burton <me@vernburton.com>
Signed-off-by: Vern Burton <me@vernburton.com>
@tarcinil tarcinil requested a review from a team as a code owner December 30, 2017 22:28
@tarcinil tarcinil changed the title Feature/port for mssql session add port for mssql_session Dec 30, 2017
Copy link
Contributor

@adamleff adamleff left a comment

Choose a reason for hiding this comment

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

@tarcinil fantastic PR - thank you! Just two small changes we need to make to ensure backward compatibility for now (even though I think your change is an accurate one). Comments below.

@instance = opts[:instance]

# check if sqlcmd is available
return skip_resource('sqlcmd is missing') if !inspec.command('sqlcmd').exist?
raise Inspec::Exceptions::ResourceFailed, 'sqlcmd is missing' unless inspec.command('sqlcmd').exist?
Copy link
Contributor

Choose a reason for hiding this comment

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

This is technically a breaking change since we mark the resource as "skipped" and not failed. In principle, I think I agree with you that we should fail, but we have to do that during a major version bump.

For now, we should change this to Inspec::Exceptions::ResourceSkipped

# check that database is reachable
return skip_resource("Can't connect to the MS SQL Server.") if !test_connection
raise Inspec::Exceptions::ResourceFailed, "Can't connect to the MS SQL Server." unless test_connection
Copy link
Contributor

Choose a reason for hiding this comment

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

Same change as above - we need to skip the resource rather than fail it for now.

@adamleff adamleff changed the title add port for mssql_session mssql_session resource: add port parameter Jan 2, 2018
@adamleff adamleff added the Type: Enhancement Improves an existing feature label Jan 2, 2018
@tarcinil
Copy link
Contributor Author

tarcinil commented Jan 3, 2018

@adamleff Comments have been addressed.

Copy link
Contributor

@adamleff adamleff left a comment

Choose a reason for hiding this comment

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

Looks great, @tarcinil!

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.

Awesome work 👍 @tarcinil

@chris-rock chris-rock merged commit 712ba52 into inspec:master Jan 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Improves an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mssql_session resouce missing "port" attribute
3 participants