-
Notifications
You must be signed in to change notification settings - Fork 680
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
mssql_session resource: add port parameter #2429
Conversation
pulling chef:master
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>
There was a problem hiding this 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.
lib/resources/mssql_session.rb
Outdated
@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? |
There was a problem hiding this comment.
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
lib/resources/mssql_session.rb
Outdated
# 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 |
There was a problem hiding this comment.
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.
…elease Signed-off-by: Vern Burton <me@vernburton.com>
@adamleff Comments have been addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, @tarcinil!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work 👍 @tarcinil
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