-
Notifications
You must be signed in to change notification settings - Fork 682
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
Fix postgres_conf ability to test parameters that have a dot in them #1938
Fix postgres_conf ability to test parameters that have a dot in them #1938
Conversation
95fbac7
to
0833573
Compare
@arlimus or @chris-rock or @adamleff please review |
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.
@aaronlippold Thank for this addition. Let's add some unit tests, so that we can ensure this stays in our scope in future
@chris-rock we don't need no stinking unit tests ... lol. Ok working on them now :) |
In this case i think it is very useful especially since the postgres config includes those values! |
@chris-rock yes, I was trying to make a joke, badly it seems :) |
haha, all good |
bd3d63f
to
2c128d7
Compare
Do we really need to bring in ObjectTraverser for this change? That mixin is great for config files which are multiple-levels deep, and postgres.conf is single level (which just happens to have keys that can have dots in them, which confuse things a bit). No multidimensional hashes here. We should be able to address this need by changing the
|
@adamleff if there is a simpler solution totally open to it. I just used that approach because in the original issue you had suggested it.
I will update the code as you requested above and push again. |
Yup, and I'm not perfect and sometimes have better ideas as time goes on :) I'm fine with ObjectTraverser here, but after that discussion, I went through and checked more Postgres documentation and examples and there is no hierarchy in the config... it's flat. So we don't need ObjectTraverser here. That's the only point I'm trying to make, both in an effort to educate, but also to keep resources as simple as necessary to do the right functionality. I'll defer to @chris-rock or @arlimus if they'd like to use ObjectTraverser here or take a simpler approach. |
@adamleff Ok. Still having a few issues with that method. I am getting a Can I shoot you a copy of the updates in slack and perhaps I just made a small goof but I agree, if we don't need to pull in an entire separate lib for a simple extraction then I am all for it. |
9369737
to
e04de83
Compare
@chris-rock requested changes added. |
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 fine except for the test file. You've got my approval if we eliminate the redundant describe
in the unit test.
resource = load_resource('postgres_conf', '/etc/postgresql/9.4/main/postgresql.conf') | ||
_(resource.params('log_connections')).must_equal 'on' | ||
end | ||
end |
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.
Let's fold the two describe blocks into one as they are redundant.
describe 'Inspec::Resources::Postgres' do
it 'verify postgresql.conf config parsing of a simple key value' do
# etc...
end
it 'verify postgresql.conf config parsing of a complex key value' do
# second test here
end
end
Fixes inspec#1671 Signed-off-by: Aaron Lippold <lippold@gmail.com>
e04de83
to
c2f7ed5
Compare
@adamleff changes pushed. Thanks. |
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.
Thank you @aaronlippold for this improvement
Fixes #1671
Signed-off-by: Aaron Lippold lippold@gmail.com