{"action":"created","comment":{"url":"https://api.github.com/repos/feedhenry/fh-fhc/pulls/comments/77345397","id":77345397,"diff_hunk":"@@ -1,23 +1,31 @@\n-var _ = require('underscore');\n-var common = require(\"../common\");\n-var fhreq = require(\"./request\");\n+const _ = require('underscore');\n+const common = require(\"../common\");\n+const fhreq = require(\"./request\");\n \n-module.exports = {\n-  check: function(request, cb) {\n-    var url = '/api/v2/mbaases/' + request.target;\n-    common.doGetApiCall(fhreq.getFeedHenryUrl(), url, i18n._('Error checking MBaaS type'), function(err, response) {\n-      if (err) {\n-        return cb(err);\n-      }\n-      // Ensure that a token is provided if creating an openshift3 environment\n-      if (response.type === 'openshift3' && typeof request.token === 'undefined') {\n-        return cb(i18n._('OpenShift targets require a token to be provided'));\n-      }\n-      if (response.type === 'feedhenry' && request.token) {\n-        return cb(i18n._('FeedHenry targets do not accept tokens'));\n-      }\n+function checkMbaasType(request, cb) {\n+  const url = '/api/v2/mbaases/' + request.target;\n+  common.doGetApiCall(fhreq.getFeedHenryUrl(), url, i18n._('Error checking MBaaS type'), function checkIfTokenRequired(err, response) {\n+    if (err) {\n+      return cb(err);\n+    }\n+\n+    if (response.type === 'openshift3') {\n+      request.targetType = 'openshift3';\n+    }\n+\n+    // Ensure that a token is provided if creating an openshift3 environment\n+    if (response.type === 'openshift3' && typeof request.token === 'undefined') {\n+      return cb(i18n._('OpenShift targets require a token to be provided'));\n+    }\n+\n+    if (response.type === 'feedhenry' && request.token) {\n+      return cb(i18n._('FeedHenry targets do not accept tokens'));\n+    }\n \n-      return cb(null, request);\n-    });\n-  }\n+    return cb(null, request);\n+  });\n+};\n+\n+module.exports = {\n+  check: checkMbaasType","path":"lib/utils/mbaas-token-check.js","position":50,"original_position":50,"commit_id":"4680029ba19d9b42dde11ba95dda07c4553f0b0d","original_commit_id":"4680029ba19d9b42dde11ba95dda07c4553f0b0d","user":{"login":"aidenkeating","id":8698527,"avatar_url":"https://avatars.githubusercontent.com/u/8698527?v=3","gravatar_id":"","url":"https://api.github.com/users/aidenkeating","html_url":"https://github.com/aidenkeating","followers_url":"https://api.github.com/users/aidenkeating/followers","following_url":"https://api.github.com/users/aidenkeating/following{/other_user}","gists_url":"https://api.github.com/users/aidenkeating/gists{/gist_id}","starred_url":"https://api.github.com/users/aidenkeating/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aidenkeating/subscriptions","organizations_url":"https://api.github.com/users/aidenkeating/orgs","repos_url":"https://api.github.com/users/aidenkeating/repos","events_url":"https://api.github.com/users/aidenkeating/events{/privacy}","received_events_url":"https://api.github.com/users/aidenkeating/received_events","type":"User","site_admin":false},"body":"This gets used as a check before [creating](https://github.com/feedhenry/fh-fhc/blob/master/lib/cmd/fh3/admin/environments/create.js#L40) or [updating](https://github.com/feedhenry/fh-fhc/blob/master/lib/cmd/fh3/admin/environments/update.js#L30) an environment. It ensures that if the environment that is being created is on an `openshift3` target that a token is provided. It turns out that there must be a `targetType` value in the request body to ensure supercore uses the `openshift3` handler to create the environment. I've just updated the check to append this `targetType` value if the MBaaS target is an `openshift3` one so now the environment project is created as expected.","created_at":"2016-09-02T13:27:30Z","updated_at":"2016-09-02T13:27:31Z","html_url":"https://github.com/feedhenry/fh-fhc/pull/240#discussion_r77345397","pull_request_url":"https://api.github.com/repos/feedhenry/fh-fhc/pulls/240","_links":{"self":{"href":"https://api.github.com/repos/feedhenry/fh-fhc/pulls/comments/77345397"},"html":{"href":"https://github.com/feedhenry/fh-fhc/pull/240#discussion_r77345397"},"pull_request":{"href":"https://api.github.com/repos/feedhenry/fh-fhc/pulls/240"}}},"pull_request":{"url":"https://api.github.com/repos/feedhenry/fh-fhc/pulls/240","id":83798710,"html_url":"https://github.com/feedhenry/fh-fhc/pull/240","diff_url":"https://github.com/feedhenry/fh-fhc/pull/240.diff","patch_url":"https://github.com/feedhenry/fh-fhc/pull/240.patch","issue_url":"https://api.github.com/repos/feedhenry/fh-fhc/issues/240","number":240,"state":"open","locked":false,"title":"RHMAP-10037 Fix environment project creation in OpenShift","user":{"login":"aidenkeating","id":8698527,"avatar_url":"https://avatars.githubusercontent.com/u/8698527?v=3","gravatar_id":"","url":"https://api.github.com/users/aidenkeating","html_url":"https://github.com/aidenkeating","followers_url":"https://api.github.com/users/aidenkeating/followers","following_url":"https://api.github.com/users/aidenkeating/following{/other_user}","gists_url":"https://api.github.com/users/aidenkeating/gists{/gist_id}","starred_url":"https://api.github.com/users/aidenkeating/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aidenkeating/subscriptions","organizations_url":"https://api.github.com/users/aidenkeating/orgs","repos_url":"https://api.github.com/users/aidenkeating/repos","events_url":"https://api.github.com/users/aidenkeating/events{/privacy}","received_events_url":"https://api.github.com/users/aidenkeating/received_events","type":"User","site_admin":false},"body":"Currently when an environment is created through `fhc` the corresponding\nenvironment project is not created.\n\nThis is because of the missing `targetType` key on the request to `fh-supercore`.\n\nThis adds the `targetType` of `openshift3` when the mbaas is discovered to have\nbeen an OpenShift 3 on in the pre-request check.","created_at":"2016-09-02T13:08:40Z","updated_at":"2016-09-02T13:27:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"561b3328b964a4f37c83800022e86dbd8e6f9869","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/feedhenry/fh-fhc/pulls/240/commits","review_comments_url":"https://api.github.com/repos/feedhenry/fh-fhc/pulls/240/comments","review_comment_url":"https://api.github.com/repos/feedhenry/fh-fhc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/feedhenry/fh-fhc/issues/240/comments","statuses_url":"https://api.github.com/repos/feedhenry/fh-fhc/statuses/4680029ba19d9b42dde11ba95dda07c4553f0b0d","head":{"label":"aidenkeating:RHMAP-10037","ref":"RHMAP-10037","sha":"4680029ba19d9b42dde11ba95dda07c4553f0b0d","user":{"login":"aidenkeating","id":8698527,"avatar_url":"https://avatars.githubusercontent.com/u/8698527?v=3","gravatar_id":"","url":"https://api.github.com/users/aidenkeating","html_url":"https://github.com/aidenkeating","followers_url":"https://api.github.com/users/aidenkeating/followers","following_url":"https://api.github.com/users/aidenkeating/following{/other_user}","gists_url":"https://api.github.com/users/aidenkeating/gists{/gist_id}","starred_url":"https://api.github.com/users/aidenkeating/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aidenkeating/subscriptions","organizations_url":"https://api.github.com/users/aidenkeating/orgs","repos_url":"https://api.github.com/users/aidenkeating/repos","events_url":"https://api.github.com/users/aidenkeating/events{/privacy}","received_events_url":"https://api.github.com/users/aidenkeating/received_events","type":"User","site_admin":false},"repo":{"id":60606840,"name":"fh-fhc","full_name":"aidenkeating/fh-fhc","owner":{"login":"aidenkeating","id":8698527,"avatar_url":"https://avatars.githubusercontent.com/u/8698527?v=3","gravatar_id":"","url":"https://api.github.com/users/aidenkeating","html_url":"https://github.com/aidenkeating","followers_url":"https://api.github.com/users/aidenkeating/followers","following_url":"https://api.github.com/users/aidenkeating/following{/other_user}","gists_url":"https://api.github.com/users/aidenkeating/gists{/gist_id}","starred_url":"https://api.github.com/users/aidenkeating/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aidenkeating/subscriptions","organizations_url":"https://api.github.com/users/aidenkeating/orgs","repos_url":"https://api.github.com/users/aidenkeating/repos","events_url":"https://api.github.com/users/aidenkeating/events{/privacy}","received_events_url":"https://api.github.com/users/aidenkeating/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aidenkeating/fh-fhc","description":"FeedHenry CLI, the Command Line Interface to FeedHenry","fork":true,"url":"https://api.github.com/repos/aidenkeating/fh-fhc","forks_url":"https://api.github.com/repos/aidenkeating/fh-fhc/forks","keys_url":"https://api.github.com/repos/aidenkeating/fh-fhc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aidenkeating/fh-fhc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aidenkeating/fh-fhc/teams","hooks_url":"https://api.github.com/repos/aidenkeating/fh-fhc/hooks","issue_events_url":"https://api.github.com/repos/aidenkeating/fh-fhc/issues/events{/number}","events_url":"https://api.github.com/repos/aidenkeating/fh-fhc/events","assignees_url":"https://api.github.com/repos/aidenkeating/fh-fhc/assignees{/user}","branches_url":"https://api.github.com/repos/aidenkeating/fh-fhc/branches{/branch}","tags_url":"https://api.github.com/repos/aidenkeating/fh-fhc/tags","blobs_url":"https://api.github.com/repos/aidenkeating/fh-fhc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aidenkeating/fh-fhc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aidenkeating/fh-fhc/git/refs{/sha}","trees_url":"https://api.github.com/repos/aidenkeating/fh-fhc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aidenkeating/fh-fhc/statuses/{sha}","languages_url":"https://api.github.com/repos/aidenkeating/fh-fhc/languages","stargazers_url":"https://api.github.com/repos/aidenkeating/fh-fhc/stargazers","contributors_url":"https://api.github.com/repos/aidenkeating/fh-fhc/contributors","subscribers_url":"https://api.github.com/repos/aidenkeating/fh-fhc/subscribers","subscription_url":"https://api.github.com/repos/aidenkeating/fh-fhc/subscription","commits_url":"https://api.github.com/repos/aidenkeating/fh-fhc/commits{/sha}","git_commits_url":"https://api.github.com/repos/aidenkeating/fh-fhc/git/commits{/sha}","comments_url":"https://api.github.com/repos/aidenkeating/fh-fhc/comments{/number}","issue_comment_url":"https://api.github.com/repos/aidenkeating/fh-fhc/issues/comments{/number}","contents_url":"https://api.github.com/repos/aidenkeating/fh-fhc/contents/{+path}","compare_url":"https://api.github.com/repos/aidenkeating/fh-fhc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aidenkeating/fh-fhc/merges","archive_url":"https://api.github.com/repos/aidenkeating/fh-fhc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aidenkeating/fh-fhc/downloads","issues_url":"https://api.github.com/repos/aidenkeating/fh-fhc/issues{/number}","pulls_url":"https://api.github.com/repos/aidenkeating/fh-fhc/pulls{/number}","milestones_url":"https://api.github.com/repos/aidenkeating/fh-fhc/milestones{/number}","notifications_url":"https://api.github.com/repos/aidenkeating/fh-fhc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aidenkeating/fh-fhc/labels{/name}","releases_url":"https://api.github.com/repos/aidenkeating/fh-fhc/releases{/id}","deployments_url":"https://api.github.com/repos/aidenkeating/fh-fhc/deployments","created_at":"2016-06-07T11:06:59Z","updated_at":"2016-06-07T11:07:01Z","pushed_at":"2016-09-02T13:12:44Z","git_url":"git://github.com/aidenkeating/fh-fhc.git","ssh_url":"git@github.com:aidenkeating/fh-fhc.git","clone_url":"https://github.com/aidenkeating/fh-fhc.git","svn_url":"https://github.com/aidenkeating/fh-fhc","homepage":"","size":2353,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"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":"feedhenry:master","ref":"master","sha":"22a23fd25b9d7423da68dcac19d1dc8d826510fa","user":{"login":"feedhenry","id":772226,"avatar_url":"https://avatars.githubusercontent.com/u/772226?v=3","gravatar_id":"","url":"https://api.github.com/users/feedhenry","html_url":"https://github.com/feedhenry","followers_url":"https://api.github.com/users/feedhenry/followers","following_url":"https://api.github.com/users/feedhenry/following{/other_user}","gists_url":"https://api.github.com/users/feedhenry/gists{/gist_id}","starred_url":"https://api.github.com/users/feedhenry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feedhenry/subscriptions","organizations_url":"https://api.github.com/users/feedhenry/orgs","repos_url":"https://api.github.com/users/feedhenry/repos","events_url":"https://api.github.com/users/feedhenry/events{/privacy}","received_events_url":"https://api.github.com/users/feedhenry/received_events","type":"Organization","site_admin":false},"repo":{"id":2850815,"name":"fh-fhc","full_name":"feedhenry/fh-fhc","owner":{"login":"feedhenry","id":772226,"avatar_url":"https://avatars.githubusercontent.com/u/772226?v=3","gravatar_id":"","url":"https://api.github.com/users/feedhenry","html_url":"https://github.com/feedhenry","followers_url":"https://api.github.com/users/feedhenry/followers","following_url":"https://api.github.com/users/feedhenry/following{/other_user}","gists_url":"https://api.github.com/users/feedhenry/gists{/gist_id}","starred_url":"https://api.github.com/users/feedhenry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feedhenry/subscriptions","organizations_url":"https://api.github.com/users/feedhenry/orgs","repos_url":"https://api.github.com/users/feedhenry/repos","events_url":"https://api.github.com/users/feedhenry/events{/privacy}","received_events_url":"https://api.github.com/users/feedhenry/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/feedhenry/fh-fhc","description":"FeedHenry CLI, the Command Line Interface to FeedHenry","fork":false,"url":"https://api.github.com/repos/feedhenry/fh-fhc","forks_url":"https://api.github.com/repos/feedhenry/fh-fhc/forks","keys_url":"https://api.github.com/repos/feedhenry/fh-fhc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/feedhenry/fh-fhc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/feedhenry/fh-fhc/teams","hooks_url":"https://api.github.com/repos/feedhenry/fh-fhc/hooks","issue_events_url":"https://api.github.com/repos/feedhenry/fh-fhc/issues/events{/number}","events_url":"https://api.github.com/repos/feedhenry/fh-fhc/events","assignees_url":"https://api.github.com/repos/feedhenry/fh-fhc/assignees{/user}","branches_url":"https://api.github.com/repos/feedhenry/fh-fhc/branches{/branch}","tags_url":"https://api.github.com/repos/feedhenry/fh-fhc/tags","blobs_url":"https://api.github.com/repos/feedhenry/fh-fhc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/feedhenry/fh-fhc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/feedhenry/fh-fhc/git/refs{/sha}","trees_url":"https://api.github.com/repos/feedhenry/fh-fhc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/feedhenry/fh-fhc/statuses/{sha}","languages_url":"https://api.github.com/repos/feedhenry/fh-fhc/languages","stargazers_url":"https://api.github.com/repos/feedhenry/fh-fhc/stargazers","contributors_url":"https://api.github.com/repos/feedhenry/fh-fhc/contributors","subscribers_url":"https://api.github.com/repos/feedhenry/fh-fhc/subscribers","subscription_url":"https://api.github.com/repos/feedhenry/fh-fhc/subscription","commits_url":"https://api.github.com/repos/feedhenry/fh-fhc/commits{/sha}","git_commits_url":"https://api.github.com/repos/feedhenry/fh-fhc/git/commits{/sha}","comments_url":"https://api.github.com/repos/feedhenry/fh-fhc/comments{/number}","issue_comment_url":"https://api.github.com/repos/feedhenry/fh-fhc/issues/comments{/number}","contents_url":"https://api.github.com/repos/feedhenry/fh-fhc/contents/{+path}","compare_url":"https://api.github.com/repos/feedhenry/fh-fhc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/feedhenry/fh-fhc/merges","archive_url":"https://api.github.com/repos/feedhenry/fh-fhc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/feedhenry/fh-fhc/downloads","issues_url":"https://api.github.com/repos/feedhenry/fh-fhc/issues{/number}","pulls_url":"https://api.github.com/repos/feedhenry/fh-fhc/pulls{/number}","milestones_url":"https://api.github.com/repos/feedhenry/fh-fhc/milestones{/number}","notifications_url":"https://api.github.com/repos/feedhenry/fh-fhc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/feedhenry/fh-fhc/labels{/name}","releases_url":"https://api.github.com/repos/feedhenry/fh-fhc/releases{/id}","deployments_url":"https://api.github.com/repos/feedhenry/fh-fhc/deployments","created_at":"2011-11-25T16:34:58Z","updated_at":"2016-08-25T08:00:14Z","pushed_at":"2016-09-02T13:12:45Z","git_url":"git://github.com/feedhenry/fh-fhc.git","ssh_url":"git@github.com:feedhenry/fh-fhc.git","clone_url":"https://github.com/feedhenry/fh-fhc.git","svn_url":"https://github.com/feedhenry/fh-fhc","homepage":"","size":2494,"stargazers_count":25,"watchers_count":25,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":57,"mirror_url":null,"open_issues_count":13,"forks":57,"open_issues":13,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/feedhenry/fh-fhc/pulls/240"},"html":{"href":"https://github.com/feedhenry/fh-fhc/pull/240"},"issue":{"href":"https://api.github.com/repos/feedhenry/fh-fhc/issues/240"},"comments":{"href":"https://api.github.com/repos/feedhenry/fh-fhc/issues/240/comments"},"review_comments":{"href":"https://api.github.com/repos/feedhenry/fh-fhc/pulls/240/comments"},"review_comment":{"href":"https://api.github.com/repos/feedhenry/fh-fhc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/feedhenry/fh-fhc/pulls/240/commits"},"statuses":{"href":"https://api.github.com/repos/feedhenry/fh-fhc/statuses/4680029ba19d9b42dde11ba95dda07c4553f0b0d"}}}}
{"actor":{"display_login":"aidenkeating"}}