{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/mongodb/pulls/comments/65079362","id":65079362,"diff_hunk":"@@ -74,26 +74,25 @@ if [ -z \"${MONGODB_REPLICA_NAME-}\" ]; then\n     usage\n   fi\n   # Run the MongoDB in 'standalone' mode\n-  if [ ! -f ${MONGODB_DATADIR}/.mongodb_datadir_initialized ]; then\n-    # Create MongoDB users and restart MongoDB with authentication enabled\n-    # At this time the MongoDB does not accept the incoming connections.\n-    mongod $mongo_common_args & #--bind_ip 127.0.0.1 --quiet >/dev/null &\n-    wait_for_mongo_up\n+  mongod $mongo_common_args &\n+  wait_for_mongo_up\n+  js_command=\"db.system.users.count({'user':'admin'})\"\n+  if [ \"$(mongo admin --quiet --eval \"$js_command\")\" == \"1\" ]; then\n+    echo \"=> Admin user is already created. Reseting password ...\"\n+    mongo_reset_admin\n+  else\n     mongo_create_admin\n-    mongo_create_user\n-    touch ${MONGODB_DATADIR}/.mongodb_datadir_initialized\n-    # Restart the MongoDB daemon to bind on all interfaces\n-    mongod $mongo_common_args --shutdown\n-    wait_for_mongo_down\n+  fi\n+  js_command=\"db.system.users.count({'user':'${MONGODB_USER}'})\"","path":"2.4/root/usr/bin/run-mongod","position":23,"original_position":23,"commit_id":"973bb30fb7e7b433caeca2e8d7f1f4277faa2f68","original_commit_id":"973bb30fb7e7b433caeca2e8d7f1f4277faa2f68","user":{"login":"rhcarvalho","id":88819,"avatar_url":"https://avatars.githubusercontent.com/u/88819?v=3","gravatar_id":"","url":"https://api.github.com/users/rhcarvalho","html_url":"https://github.com/rhcarvalho","followers_url":"https://api.github.com/users/rhcarvalho/followers","following_url":"https://api.github.com/users/rhcarvalho/following{/other_user}","gists_url":"https://api.github.com/users/rhcarvalho/gists{/gist_id}","starred_url":"https://api.github.com/users/rhcarvalho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhcarvalho/subscriptions","organizations_url":"https://api.github.com/users/rhcarvalho/orgs","repos_url":"https://api.github.com/users/rhcarvalho/repos","events_url":"https://api.github.com/users/rhcarvalho/events{/privacy}","received_events_url":"https://api.github.com/users/rhcarvalho/received_events","type":"User","site_admin":false},"body":"What if `MONGODB_USER` is changed?\r\n\r\nI think that was not properly supported before, only password changes.\r\nSo this seems good, if the value of `MONGODB_USER` is changed, it will create a new user (and the old user is left intact). :+1: ","created_at":"2016-05-30T14:33:40Z","updated_at":"2016-05-30T14:33:40Z","html_url":"https://github.com/openshift/mongodb/pull/157#discussion_r65079362","pull_request_url":"https://api.github.com/repos/openshift/mongodb/pulls/157","_links":{"self":{"href":"https://api.github.com/repos/openshift/mongodb/pulls/comments/65079362"},"html":{"href":"https://github.com/openshift/mongodb/pull/157#discussion_r65079362"},"pull_request":{"href":"https://api.github.com/repos/openshift/mongodb/pulls/157"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/mongodb/pulls/157","id":69138271,"html_url":"https://github.com/openshift/mongodb/pull/157","diff_url":"https://github.com/openshift/mongodb/pull/157.diff","patch_url":"https://github.com/openshift/mongodb/pull/157.patch","issue_url":"https://api.github.com/repos/openshift/mongodb/issues/157","number":157,"state":"open","locked":false,"title":"Do not rely on hidden file in dbpath","user":{"login":"omron93","id":3758789,"avatar_url":"https://avatars.githubusercontent.com/u/3758789?v=3","gravatar_id":"","url":"https://api.github.com/users/omron93","html_url":"https://github.com/omron93","followers_url":"https://api.github.com/users/omron93/followers","following_url":"https://api.github.com/users/omron93/following{/other_user}","gists_url":"https://api.github.com/users/omron93/gists{/gist_id}","starred_url":"https://api.github.com/users/omron93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omron93/subscriptions","organizations_url":"https://api.github.com/users/omron93/orgs","repos_url":"https://api.github.com/users/omron93/repos","events_url":"https://api.github.com/users/omron93/events{/privacy}","received_events_url":"https://api.github.com/users/omron93/received_events","type":"User","site_admin":false},"body":"In current situation scripts check if database path contains file `.mongodb_datadir_initialized`. It allows user to mount database directory inside a container.\r\nHowever if user mounts dbpath not created by openshift images this file does not exists!\r\n\r\nThis PR allows scripts to check if a user is present without relying on this hidden file. So it is possible to mount database from non container deployment.\r\nThis change is also part of removing dependencies of scripts on mongodb options - it necessary to allow using custom config file in #147","created_at":"2016-05-06T11:28:39Z","updated_at":"2016-05-30T14:33:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"84eab011096431334b360b917a94e51e63a6a2ba","assignee":{"login":"php-coder","id":87088,"avatar_url":"https://avatars.githubusercontent.com/u/87088?v=3","gravatar_id":"","url":"https://api.github.com/users/php-coder","html_url":"https://github.com/php-coder","followers_url":"https://api.github.com/users/php-coder/followers","following_url":"https://api.github.com/users/php-coder/following{/other_user}","gists_url":"https://api.github.com/users/php-coder/gists{/gist_id}","starred_url":"https://api.github.com/users/php-coder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/php-coder/subscriptions","organizations_url":"https://api.github.com/users/php-coder/orgs","repos_url":"https://api.github.com/users/php-coder/repos","events_url":"https://api.github.com/users/php-coder/events{/privacy}","received_events_url":"https://api.github.com/users/php-coder/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/openshift/mongodb/pulls/157/commits","review_comments_url":"https://api.github.com/repos/openshift/mongodb/pulls/157/comments","review_comment_url":"https://api.github.com/repos/openshift/mongodb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/mongodb/issues/157/comments","statuses_url":"https://api.github.com/repos/openshift/mongodb/statuses/973bb30fb7e7b433caeca2e8d7f1f4277faa2f68","head":{"label":"omron93:check-users-in-database","ref":"check-users-in-database","sha":"973bb30fb7e7b433caeca2e8d7f1f4277faa2f68","user":{"login":"omron93","id":3758789,"avatar_url":"https://avatars.githubusercontent.com/u/3758789?v=3","gravatar_id":"","url":"https://api.github.com/users/omron93","html_url":"https://github.com/omron93","followers_url":"https://api.github.com/users/omron93/followers","following_url":"https://api.github.com/users/omron93/following{/other_user}","gists_url":"https://api.github.com/users/omron93/gists{/gist_id}","starred_url":"https://api.github.com/users/omron93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omron93/subscriptions","organizations_url":"https://api.github.com/users/omron93/orgs","repos_url":"https://api.github.com/users/omron93/repos","events_url":"https://api.github.com/users/omron93/events{/privacy}","received_events_url":"https://api.github.com/users/omron93/received_events","type":"User","site_admin":false},"repo":{"id":36733508,"name":"mongodb","full_name":"omron93/mongodb","owner":{"login":"omron93","id":3758789,"avatar_url":"https://avatars.githubusercontent.com/u/3758789?v=3","gravatar_id":"","url":"https://api.github.com/users/omron93","html_url":"https://github.com/omron93","followers_url":"https://api.github.com/users/omron93/followers","following_url":"https://api.github.com/users/omron93/following{/other_user}","gists_url":"https://api.github.com/users/omron93/gists{/gist_id}","starred_url":"https://api.github.com/users/omron93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omron93/subscriptions","organizations_url":"https://api.github.com/users/omron93/orgs","repos_url":"https://api.github.com/users/omron93/repos","events_url":"https://api.github.com/users/omron93/events{/privacy}","received_events_url":"https://api.github.com/users/omron93/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/omron93/mongodb","description":"","fork":true,"url":"https://api.github.com/repos/omron93/mongodb","forks_url":"https://api.github.com/repos/omron93/mongodb/forks","keys_url":"https://api.github.com/repos/omron93/mongodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/omron93/mongodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/omron93/mongodb/teams","hooks_url":"https://api.github.com/repos/omron93/mongodb/hooks","issue_events_url":"https://api.github.com/repos/omron93/mongodb/issues/events{/number}","events_url":"https://api.github.com/repos/omron93/mongodb/events","assignees_url":"https://api.github.com/repos/omron93/mongodb/assignees{/user}","branches_url":"https://api.github.com/repos/omron93/mongodb/branches{/branch}","tags_url":"https://api.github.com/repos/omron93/mongodb/tags","blobs_url":"https://api.github.com/repos/omron93/mongodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/omron93/mongodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/omron93/mongodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/omron93/mongodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/omron93/mongodb/statuses/{sha}","languages_url":"https://api.github.com/repos/omron93/mongodb/languages","stargazers_url":"https://api.github.com/repos/omron93/mongodb/stargazers","contributors_url":"https://api.github.com/repos/omron93/mongodb/contributors","subscribers_url":"https://api.github.com/repos/omron93/mongodb/subscribers","subscription_url":"https://api.github.com/repos/omron93/mongodb/subscription","commits_url":"https://api.github.com/repos/omron93/mongodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/omron93/mongodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/omron93/mongodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/omron93/mongodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/omron93/mongodb/contents/{+path}","compare_url":"https://api.github.com/repos/omron93/mongodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/omron93/mongodb/merges","archive_url":"https://api.github.com/repos/omron93/mongodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/omron93/mongodb/downloads","issues_url":"https://api.github.com/repos/omron93/mongodb/issues{/number}","pulls_url":"https://api.github.com/repos/omron93/mongodb/pulls{/number}","milestones_url":"https://api.github.com/repos/omron93/mongodb/milestones{/number}","notifications_url":"https://api.github.com/repos/omron93/mongodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/omron93/mongodb/labels{/name}","releases_url":"https://api.github.com/repos/omron93/mongodb/releases{/id}","deployments_url":"https://api.github.com/repos/omron93/mongodb/deployments","created_at":"2015-06-02T13:03:57Z","updated_at":"2016-03-07T11:58:29Z","pushed_at":"2016-05-27T12:23:20Z","git_url":"git://github.com/omron93/mongodb.git","ssh_url":"git@github.com:omron93/mongodb.git","clone_url":"https://github.com/omron93/mongodb.git","svn_url":"https://github.com/omron93/mongodb","homepage":null,"size":270,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"de04adbd3e1179ca3044fc55696192c8877570fd","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":31970825,"name":"mongodb","full_name":"openshift/mongodb","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/mongodb","description":"","fork":false,"url":"https://api.github.com/repos/openshift/mongodb","forks_url":"https://api.github.com/repos/openshift/mongodb/forks","keys_url":"https://api.github.com/repos/openshift/mongodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/mongodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/mongodb/teams","hooks_url":"https://api.github.com/repos/openshift/mongodb/hooks","issue_events_url":"https://api.github.com/repos/openshift/mongodb/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/mongodb/events","assignees_url":"https://api.github.com/repos/openshift/mongodb/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/mongodb/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/mongodb/tags","blobs_url":"https://api.github.com/repos/openshift/mongodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/mongodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/mongodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/mongodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/mongodb/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/mongodb/languages","stargazers_url":"https://api.github.com/repos/openshift/mongodb/stargazers","contributors_url":"https://api.github.com/repos/openshift/mongodb/contributors","subscribers_url":"https://api.github.com/repos/openshift/mongodb/subscribers","subscription_url":"https://api.github.com/repos/openshift/mongodb/subscription","commits_url":"https://api.github.com/repos/openshift/mongodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/mongodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/mongodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/mongodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/mongodb/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/mongodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/mongodb/merges","archive_url":"https://api.github.com/repos/openshift/mongodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/mongodb/downloads","issues_url":"https://api.github.com/repos/openshift/mongodb/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/mongodb/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/mongodb/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/mongodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/mongodb/labels{/name}","releases_url":"https://api.github.com/repos/openshift/mongodb/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/mongodb/deployments","created_at":"2015-03-10T17:15:19Z","updated_at":"2016-03-14T18:11:52Z","pushed_at":"2016-05-27T14:21:15Z","git_url":"git://github.com/openshift/mongodb.git","ssh_url":"git@github.com:openshift/mongodb.git","clone_url":"https://github.com/openshift/mongodb.git","svn_url":"https://github.com/openshift/mongodb","homepage":null,"size":410,"stargazers_count":6,"watchers_count":6,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":19,"forks":49,"open_issues":19,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/mongodb/pulls/157"},"html":{"href":"https://github.com/openshift/mongodb/pull/157"},"issue":{"href":"https://api.github.com/repos/openshift/mongodb/issues/157"},"comments":{"href":"https://api.github.com/repos/openshift/mongodb/issues/157/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/mongodb/pulls/157/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/mongodb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/mongodb/pulls/157/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/mongodb/statuses/973bb30fb7e7b433caeca2e8d7f1f4277faa2f68"}}}}
{"actor":{"display_login":"rhcarvalho"}}