{"action":"created","comment":{"url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/comments/134513902","pull_request_review_id":57510614,"id":134513902,"diff_hunk":"@@ -0,0 +1,93 @@\n+package admin\n+\n+import (\n+\t\"github.com/evergreen-ci/evergreen/db\"\n+\t\"github.com/evergreen-ci/evergreen/db/bsonutil\"\n+\t\"github.com/pkg/errors\"\n+\t\"gopkg.in/mgo.v2/bson\"\n+)\n+\n+const (\n+\tCollection       = \"admin\"\n+\tsystemSettingsID = \"0\"\n+)\n+\n+var (\n+\tIdKey     = bsonutil.MustHaveTag(AdminSettings{}, \"Id\")\n+\tBannerKey = bsonutil.MustHaveTag(AdminSettings{}, \"Banner\")\n+\n+\tServiceFlagsKey  = bsonutil.MustHaveTag(AdminSettings{}, \"ServiceFlags\")\n+\tTaskDispatchKey  = bsonutil.MustHaveTag(ServiceFlags{}, \"TaskDispatchDisabled\")\n+\tHostinitKey      = bsonutil.MustHaveTag(ServiceFlags{}, \"HostinitDisabled\")\n+\tMonitorKey       = bsonutil.MustHaveTag(ServiceFlags{}, \"MonitorDisabled\")\n+\tNotificationsKey = bsonutil.MustHaveTag(ServiceFlags{}, \"NotificationsDisabled\")\n+\tAlertsKey        = bsonutil.MustHaveTag(ServiceFlags{}, \"AlertsDisabled\")\n+\tTaskrunnerKey    = bsonutil.MustHaveTag(ServiceFlags{}, \"TaskrunnerDisabled\")\n+\tRepotrackerKey   = bsonutil.MustHaveTag(ServiceFlags{}, \"RepotrackerDisabled\")\n+\tSchedulerKey     = bsonutil.MustHaveTag(ServiceFlags{}, \"SchedulerDisabled\")\n+)\n+\n+var settingsQuery = db.Query(bson.M{IdKey: systemSettingsID})\n+\n+func GetSettingsFromDB() (*AdminSettings, error) {\n+\tsettings := &AdminSettings{}\n+\tquery := db.Q{}\n+\tquery = query.Filter(settingsQuery)\n+\terr := db.FindOneQ(Collection, query, settings)\n+\tif err != nil {\n+\t\treturn nil, errors.Wrap(err, \"Error retrieving admin settings from DB\")\n+\t}\n+\tif settings == nil {\n+\t\treturn nil, errors.New(\"Settings are nil\")\n+\t}\n+\treturn settings, nil\n+}\n+\n+func SetBanner(bannerText string) error {\n+\t_, err := db.Upsert(\n+\t\tCollection,\n+\t\tsettingsQuery,\n+\t\tbson.M{\n+\t\t\t\"$set\": bson.M{IdKey: systemSettingsID, BannerKey: bannerText},\n+\t\t},\n+\t)\n+\n+\treturn err\n+}\n+\n+func SetTaskDispatchDisabled(disableTasks bool) error {\n+\t_, err := db.Upsert(\n+\t\tCollection,\n+\t\tsettingsQuery,\n+\t\tbson.M{\n+\t\t\t\"$set\": bson.M{IdKey: systemSettingsID, TaskDispatchKey: disableTasks},\n+\t\t},\n+\t)\n+\n+\treturn err\n+}\n+\n+func SetRunnerFlags(flags ServiceFlags) error {\n+\t_, err := db.Upsert(\n+\t\tCollection,\n+\t\tsettingsQuery,\n+\t\tbson.M{\n+\t\t\t\"$set\": bson.M{IdKey: systemSettingsID, ServiceFlagsKey: flags},\n+\t\t},\n+\t)\n+\n+\treturn err\n+}\n+\n+func Upsert(settings *AdminSettings) error {","path":"model/admin/db.go","position":82,"original_position":82,"commit_id":"d3234404c79837ab184432e6f83f739dbf4ae39c","original_commit_id":"d3234404c79837ab184432e6f83f739dbf4ae39c","user":{"login":"tychoish","id":17534,"avatar_url":"https://avatars1.githubusercontent.com/u/17534?v=4","gravatar_id":"","url":"https://api.github.com/users/tychoish","html_url":"https://github.com/tychoish","followers_url":"https://api.github.com/users/tychoish/followers","following_url":"https://api.github.com/users/tychoish/following{/other_user}","gists_url":"https://api.github.com/users/tychoish/gists{/gist_id}","starred_url":"https://api.github.com/users/tychoish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tychoish/subscriptions","organizations_url":"https://api.github.com/users/tychoish/orgs","repos_url":"https://api.github.com/users/tychoish/repos","events_url":"https://api.github.com/users/tychoish/events{/privacy}","received_events_url":"https://api.github.com/users/tychoish/received_events","type":"User","site_admin":false},"body":"does this need to be exported?\r\n\r\nis it used?","created_at":"2017-08-22T15:19:15Z","updated_at":"2017-08-22T15:20:39Z","html_url":"https://github.com/evergreen-ci/evergreen/pull/66#discussion_r134513902","pull_request_url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/66","_links":{"self":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/comments/134513902"},"html":{"href":"https://github.com/evergreen-ci/evergreen/pull/66#discussion_r134513902"},"pull_request":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/66"}}},"pull_request":{"url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/66","id":136362694,"html_url":"https://github.com/evergreen-ci/evergreen/pull/66","diff_url":"https://github.com/evergreen-ci/evergreen/pull/66.diff","patch_url":"https://github.com/evergreen-ci/evergreen/pull/66.patch","issue_url":"https://api.github.com/repos/evergreen-ci/evergreen/issues/66","number":66,"state":"open","locked":false,"title":"EVG-1965 make services check admin flags","user":{"login":"john-m-liu","id":29384396,"avatar_url":"https://avatars2.githubusercontent.com/u/29384396?v=4","gravatar_id":"","url":"https://api.github.com/users/john-m-liu","html_url":"https://github.com/john-m-liu","followers_url":"https://api.github.com/users/john-m-liu/followers","following_url":"https://api.github.com/users/john-m-liu/following{/other_user}","gists_url":"https://api.github.com/users/john-m-liu/gists{/gist_id}","starred_url":"https://api.github.com/users/john-m-liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/john-m-liu/subscriptions","organizations_url":"https://api.github.com/users/john-m-liu/orgs","repos_url":"https://api.github.com/users/john-m-liu/repos","events_url":"https://api.github.com/users/john-m-liu/events{/privacy}","received_events_url":"https://api.github.com/users/john-m-liu/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-08-17T21:57:40Z","updated_at":"2017-08-22T15:20:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8178b17531b0601f8e5f6a90d2d73b41f60515d8","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/66/commits","review_comments_url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/66/comments","review_comment_url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/comments{/number}","comments_url":"https://api.github.com/repos/evergreen-ci/evergreen/issues/66/comments","statuses_url":"https://api.github.com/repos/evergreen-ci/evergreen/statuses/d3234404c79837ab184432e6f83f739dbf4ae39c","head":{"label":"john-m-liu:EVG-1965","ref":"EVG-1965","sha":"d3234404c79837ab184432e6f83f739dbf4ae39c","user":{"login":"john-m-liu","id":29384396,"avatar_url":"https://avatars2.githubusercontent.com/u/29384396?v=4","gravatar_id":"","url":"https://api.github.com/users/john-m-liu","html_url":"https://github.com/john-m-liu","followers_url":"https://api.github.com/users/john-m-liu/followers","following_url":"https://api.github.com/users/john-m-liu/following{/other_user}","gists_url":"https://api.github.com/users/john-m-liu/gists{/gist_id}","starred_url":"https://api.github.com/users/john-m-liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/john-m-liu/subscriptions","organizations_url":"https://api.github.com/users/john-m-liu/orgs","repos_url":"https://api.github.com/users/john-m-liu/repos","events_url":"https://api.github.com/users/john-m-liu/events{/privacy}","received_events_url":"https://api.github.com/users/john-m-liu/received_events","type":"User","site_admin":false},"repo":{"id":100648346,"name":"evergreen","full_name":"john-m-liu/evergreen","owner":{"login":"john-m-liu","id":29384396,"avatar_url":"https://avatars2.githubusercontent.com/u/29384396?v=4","gravatar_id":"","url":"https://api.github.com/users/john-m-liu","html_url":"https://github.com/john-m-liu","followers_url":"https://api.github.com/users/john-m-liu/followers","following_url":"https://api.github.com/users/john-m-liu/following{/other_user}","gists_url":"https://api.github.com/users/john-m-liu/gists{/gist_id}","starred_url":"https://api.github.com/users/john-m-liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/john-m-liu/subscriptions","organizations_url":"https://api.github.com/users/john-m-liu/orgs","repos_url":"https://api.github.com/users/john-m-liu/repos","events_url":"https://api.github.com/users/john-m-liu/events{/privacy}","received_events_url":"https://api.github.com/users/john-m-liu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/john-m-liu/evergreen","description":"A Distributed Continuous Integration System from MongoDB","fork":true,"url":"https://api.github.com/repos/john-m-liu/evergreen","forks_url":"https://api.github.com/repos/john-m-liu/evergreen/forks","keys_url":"https://api.github.com/repos/john-m-liu/evergreen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/john-m-liu/evergreen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/john-m-liu/evergreen/teams","hooks_url":"https://api.github.com/repos/john-m-liu/evergreen/hooks","issue_events_url":"https://api.github.com/repos/john-m-liu/evergreen/issues/events{/number}","events_url":"https://api.github.com/repos/john-m-liu/evergreen/events","assignees_url":"https://api.github.com/repos/john-m-liu/evergreen/assignees{/user}","branches_url":"https://api.github.com/repos/john-m-liu/evergreen/branches{/branch}","tags_url":"https://api.github.com/repos/john-m-liu/evergreen/tags","blobs_url":"https://api.github.com/repos/john-m-liu/evergreen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/john-m-liu/evergreen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/john-m-liu/evergreen/git/refs{/sha}","trees_url":"https://api.github.com/repos/john-m-liu/evergreen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/john-m-liu/evergreen/statuses/{sha}","languages_url":"https://api.github.com/repos/john-m-liu/evergreen/languages","stargazers_url":"https://api.github.com/repos/john-m-liu/evergreen/stargazers","contributors_url":"https://api.github.com/repos/john-m-liu/evergreen/contributors","subscribers_url":"https://api.github.com/repos/john-m-liu/evergreen/subscribers","subscription_url":"https://api.github.com/repos/john-m-liu/evergreen/subscription","commits_url":"https://api.github.com/repos/john-m-liu/evergreen/commits{/sha}","git_commits_url":"https://api.github.com/repos/john-m-liu/evergreen/git/commits{/sha}","comments_url":"https://api.github.com/repos/john-m-liu/evergreen/comments{/number}","issue_comment_url":"https://api.github.com/repos/john-m-liu/evergreen/issues/comments{/number}","contents_url":"https://api.github.com/repos/john-m-liu/evergreen/contents/{+path}","compare_url":"https://api.github.com/repos/john-m-liu/evergreen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/john-m-liu/evergreen/merges","archive_url":"https://api.github.com/repos/john-m-liu/evergreen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/john-m-liu/evergreen/downloads","issues_url":"https://api.github.com/repos/john-m-liu/evergreen/issues{/number}","pulls_url":"https://api.github.com/repos/john-m-liu/evergreen/pulls{/number}","milestones_url":"https://api.github.com/repos/john-m-liu/evergreen/milestones{/number}","notifications_url":"https://api.github.com/repos/john-m-liu/evergreen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/john-m-liu/evergreen/labels{/name}","releases_url":"https://api.github.com/repos/john-m-liu/evergreen/releases{/id}","deployments_url":"https://api.github.com/repos/john-m-liu/evergreen/deployments","created_at":"2017-08-17T21:56:25Z","updated_at":"2017-08-17T21:56:29Z","pushed_at":"2017-08-22T14:28:44Z","git_url":"git://github.com/john-m-liu/evergreen.git","ssh_url":"git@github.com:john-m-liu/evergreen.git","clone_url":"https://github.com/john-m-liu/evergreen.git","svn_url":"https://github.com/john-m-liu/evergreen","homepage":"http://evergreen.mongodb.com","size":32247,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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":"evergreen-ci:master","ref":"master","sha":"e2150822474f7a4a52cba5f2202597edb0394e14","user":{"login":"evergreen-ci","id":10089490,"avatar_url":"https://avatars3.githubusercontent.com/u/10089490?v=4","gravatar_id":"","url":"https://api.github.com/users/evergreen-ci","html_url":"https://github.com/evergreen-ci","followers_url":"https://api.github.com/users/evergreen-ci/followers","following_url":"https://api.github.com/users/evergreen-ci/following{/other_user}","gists_url":"https://api.github.com/users/evergreen-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/evergreen-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evergreen-ci/subscriptions","organizations_url":"https://api.github.com/users/evergreen-ci/orgs","repos_url":"https://api.github.com/users/evergreen-ci/repos","events_url":"https://api.github.com/users/evergreen-ci/events{/privacy}","received_events_url":"https://api.github.com/users/evergreen-ci/received_events","type":"Organization","site_admin":false},"repo":{"id":36385798,"name":"evergreen","full_name":"evergreen-ci/evergreen","owner":{"login":"evergreen-ci","id":10089490,"avatar_url":"https://avatars3.githubusercontent.com/u/10089490?v=4","gravatar_id":"","url":"https://api.github.com/users/evergreen-ci","html_url":"https://github.com/evergreen-ci","followers_url":"https://api.github.com/users/evergreen-ci/followers","following_url":"https://api.github.com/users/evergreen-ci/following{/other_user}","gists_url":"https://api.github.com/users/evergreen-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/evergreen-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evergreen-ci/subscriptions","organizations_url":"https://api.github.com/users/evergreen-ci/orgs","repos_url":"https://api.github.com/users/evergreen-ci/repos","events_url":"https://api.github.com/users/evergreen-ci/events{/privacy}","received_events_url":"https://api.github.com/users/evergreen-ci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/evergreen-ci/evergreen","description":"A Distributed Continuous Integration System from MongoDB","fork":false,"url":"https://api.github.com/repos/evergreen-ci/evergreen","forks_url":"https://api.github.com/repos/evergreen-ci/evergreen/forks","keys_url":"https://api.github.com/repos/evergreen-ci/evergreen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/evergreen-ci/evergreen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/evergreen-ci/evergreen/teams","hooks_url":"https://api.github.com/repos/evergreen-ci/evergreen/hooks","issue_events_url":"https://api.github.com/repos/evergreen-ci/evergreen/issues/events{/number}","events_url":"https://api.github.com/repos/evergreen-ci/evergreen/events","assignees_url":"https://api.github.com/repos/evergreen-ci/evergreen/assignees{/user}","branches_url":"https://api.github.com/repos/evergreen-ci/evergreen/branches{/branch}","tags_url":"https://api.github.com/repos/evergreen-ci/evergreen/tags","blobs_url":"https://api.github.com/repos/evergreen-ci/evergreen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/evergreen-ci/evergreen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/evergreen-ci/evergreen/git/refs{/sha}","trees_url":"https://api.github.com/repos/evergreen-ci/evergreen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/evergreen-ci/evergreen/statuses/{sha}","languages_url":"https://api.github.com/repos/evergreen-ci/evergreen/languages","stargazers_url":"https://api.github.com/repos/evergreen-ci/evergreen/stargazers","contributors_url":"https://api.github.com/repos/evergreen-ci/evergreen/contributors","subscribers_url":"https://api.github.com/repos/evergreen-ci/evergreen/subscribers","subscription_url":"https://api.github.com/repos/evergreen-ci/evergreen/subscription","commits_url":"https://api.github.com/repos/evergreen-ci/evergreen/commits{/sha}","git_commits_url":"https://api.github.com/repos/evergreen-ci/evergreen/git/commits{/sha}","comments_url":"https://api.github.com/repos/evergreen-ci/evergreen/comments{/number}","issue_comment_url":"https://api.github.com/repos/evergreen-ci/evergreen/issues/comments{/number}","contents_url":"https://api.github.com/repos/evergreen-ci/evergreen/contents/{+path}","compare_url":"https://api.github.com/repos/evergreen-ci/evergreen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/evergreen-ci/evergreen/merges","archive_url":"https://api.github.com/repos/evergreen-ci/evergreen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/evergreen-ci/evergreen/downloads","issues_url":"https://api.github.com/repos/evergreen-ci/evergreen/issues{/number}","pulls_url":"https://api.github.com/repos/evergreen-ci/evergreen/pulls{/number}","milestones_url":"https://api.github.com/repos/evergreen-ci/evergreen/milestones{/number}","notifications_url":"https://api.github.com/repos/evergreen-ci/evergreen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/evergreen-ci/evergreen/labels{/name}","releases_url":"https://api.github.com/repos/evergreen-ci/evergreen/releases{/id}","deployments_url":"https://api.github.com/repos/evergreen-ci/evergreen/deployments","created_at":"2015-05-27T18:03:09Z","updated_at":"2017-08-08T19:48:10Z","pushed_at":"2017-08-22T15:13:45Z","git_url":"git://github.com/evergreen-ci/evergreen.git","ssh_url":"git@github.com:evergreen-ci/evergreen.git","clone_url":"https://github.com/evergreen-ci/evergreen.git","svn_url":"https://github.com/evergreen-ci/evergreen","homepage":"http://evergreen.mongodb.com","size":32246,"stargazers_count":131,"watchers_count":131,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":6,"forks":37,"open_issues":6,"watchers":131,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/66"},"html":{"href":"https://github.com/evergreen-ci/evergreen/pull/66"},"issue":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/issues/66"},"comments":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/issues/66/comments"},"review_comments":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/66/comments"},"review_comment":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/pulls/66/commits"},"statuses":{"href":"https://api.github.com/repos/evergreen-ci/evergreen/statuses/d3234404c79837ab184432e6f83f739dbf4ae39c"}}}}
{"actor":{"display_login":"tychoish"}}