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

Add user management ability #313

Merged
merged 12 commits into from
Jul 9, 2014
Merged

Add user management ability #313

merged 12 commits into from
Jul 9, 2014

Conversation

cjhubert
Copy link

@cjhubert cjhubert commented Jul 7, 2014

This PR adds the following:

  • user_management recipe, which will require auth on mongo config
  • user resource and provider
  • default users attributes
  • user_management integration tests

Should take care of #225

# this will fail on the first attempt, but user will still be created
# because of the localhost exception
begin
admin.authenticate(node[:mongodb][:admin][:username], node[:mongodb][:admin][:password])

Choose a reason for hiding this comment

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

this won't work with multiple mongos on the same box (I know nothing does, but I'd like to avoid having to change this later). Same goes for the retrieve_db's access of node[:mongodb][:host].

Perhaps a connection object like in opscode's database cookbook?

@josephholsten
Copy link

looks awesome! If it's easy to extract out a connection object (preferably with the same defaults you provide), I'd love it. but it lgtm regardless.

cjhubert added 2 commits July 7, 2014 18:40
adding connection hash to resource, using it in provider and changing de...
@cjhubert
Copy link
Author

cjhubert commented Jul 7, 2014

I've updated the code to factor out the connection object. Let me know if there are any problems with it.
Edit: Actually, looking again, I probably forgot to change all the admin.authenticates and just changed retrieve_db. Let me know if I was on the right track and I'll update authenticate as well.


# If authentication is required,
# add the admin to the users array for adding/updating
users = [admin] if node['mongodb']['config']['auth'] == true

Choose a reason for hiding this comment

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

users is undefined if node['mongodb']['config']['auth'] != true

this'll make the concat have a bad time.

Copy link
Author

Choose a reason for hiding this comment

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

Nice catch, should now be fixed.

@josephholsten
Copy link

@ceejh definitely the right track! Let me know when you're comfortable with it and I'll run a full kitchen pass against it.

Docs, tests, resources, works with multitenancy, this is quite the patch!

@cjhubert
Copy link
Author

cjhubert commented Jul 8, 2014

Should be good to go unless you see any more problems.

@@ -0,0 +1,10 @@
default['mongodb']['config']['auth'] = true

default[:mongodb][:admin] = {

Choose a reason for hiding this comment

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

' instead of : also goes for the arrays.

@jamesonjlee
Copy link

other than the style nitpick LGTM

@cjhubert
Copy link
Author

cjhubert commented Jul 9, 2014

Updated the keys to use '

@cjhubert
Copy link
Author

cjhubert commented Jul 9, 2014

Let me know if there's anything else that needs to be done to get this merged.

install_method: mongodb-org
# Needed to read the correct config file
# since mongo 2.6
default_init_name: mongod

Choose a reason for hiding this comment

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

😢 We'll fix #262 soon.

jamesonjlee added a commit that referenced this pull request Jul 9, 2014
Add user management ability
@jamesonjlee jamesonjlee merged commit ae922df into edelight:master Jul 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants