-
-
Notifications
You must be signed in to change notification settings - Fork 451
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 mongorc.js file when authentication is not enabled. #590
Conversation
Create mongorc.js erb file also when auth is not enabled. If the file is not created, functions that are stored in that file (like 'rsReconfigMember') can't be used if auth is not enabled.
Since manifests/server/config.pp creates the mongorc.js file all the time, moved the conditional for storing the credentials here.
Change ensure from "present" to "file" for mongorc.js.
Change tests to always check for the presence of mongorc.js.
| mode => '0600', | ||
| } | ||
| } else { | ||
| file { $rcfile: |
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.
I think purging the file if it's not required anymore makes sense? shouldn't we keep it?
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.
The file contains functions that are used in the code regardless if auth is enabled or not.
ie: https://github.com/voxpupuli/puppet-mongodb/blob/master/templates/mongorc.js.erb#L1 contains the 'rsReconfigMember' function that is called by 'rs_reconfig_member' in https://github.com/voxpupuli/puppet-mongodb/blob/master/lib/puppet/provider/mongodb_replset/mongo.rb#L98 . If the mongorc.js file is not present when auth is not enabled also, it will crash if a rs member is reconfigured.
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.
I think this makes sense. My only concern is that we will start to manage the file by default. On the other hand, we now ensure it's absent so the user can't have any custom things in there. That makes it a bugfix rather than breaking change.
I do think this should be squashed into a single commit, but we can do that on merge.
@bastelfreak any last comments?
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.
@ekohl looks good to me. I will squash-merge this.
Pull Request (PR) description
When mongodb auth is not enabled, puppet will crash if a RS member reconfiguration is needed since the mongorc.js file (that contains that function) is not created.
This Pull Request (PR) fixes the following issues
If the mongorc.js.erb is not created all the time, functions that are stored in it (like 'rsReconfigMember') can't be used by puppet if auth is not enabled.
Since manifests/server/config.pp will create the mongorc.js file all the time, the conditional for storing the credentials in the mongorc.js file are moved to templates/mongorc.js.erb .