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 gsub to replace invalid json values with a 1 #468
add gsub to replace invalid json values with a 1 #468
Conversation
I do not imagine it would cause a problem, but can anyone confirm that with MongoDB <3.6.3, this change will cause no issues? |
8f86c9e
to
545abd4
Compare
The initial change did not work for mongodb 3.2.x, I commit a new change now that moved the gsub to the mongo_eval function, since there was already something similar in place there, and in the replset function. I merged those "dirty" fixes into the mongo_eval function so the same fix does not need to be applied everywhere seperatly. I tested this change on mongo 3.2.x and 3.6.x and it both worked fine. should be good to merge like this @rnelson0 |
545abd4
to
62d6e6a
Compare
It looks like `out.gsub!(%r{\w+\((.+?)\)}, '\1')` is present in two
locations now. Should the instance in the second file, where you removed
just one line, also be removed?
--
Rob Nelson
|
@rnelson0 sorry for late reply, yes that line is present in 2 locations, for some reason that I havent been able to find out, the tests fail when it is not present in both locations.. I've been through the code but I can't see why since it just uses the same function as far as I can tell. So this just works. |
Could someone re-review this PR and merge it? |
@rnelson0 can you take a look again please? |
I would pull out the 'sanitation' into a separate function and then we could write some tests against that. Totally unrelated to the pull request but:
The first regex will result in:
(Notice the 3 being stripped from 123. |
f17772a
to
4490e62
Compare
'lib/puppet/provider/mongodb.rb' cleaned up the test json to pass valid json
4490e62
to
1cc2d77
Compare
lib/puppet/provider/mongodb.rb
Outdated
@@ -1,3 +1,4 @@ | |||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'util', 'mongodb_output')) |
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 feels.. dirty. Maybe implement it like https://github.com/voxpupuli/puppet-mongodb/blob/master/lib/puppet/provider/mongodb_conn_validator/tcp_port.rb#L1
See issue: #447