{"action":"created","comment":{"url":"https://api.github.com/repos/RackHD/on-tasks/pulls/comments/101557527","pull_request_review_id":22290001,"id":101557527,"diff_hunk":"@@ -140,44 +140,57 @@ function UcsDiscoveryJobFactory(\n                         return res.body;\n                     })\n                     .map(function(data) {\n-                        assert.array(data.macs);\n-                        assert.string(data.name);\n-                        assert.string(data.path);\n-\n-                        var config = Object.assign({}, self.settings);\n-                        obm = {\n-                            config: config,\n-                            service: 'ucs-obm-service'\n-                        };\n-                        var node = {\n-                            type: 'compute',\n-                            name: data.path,\n-                            identifiers: data.macs,\n-                            obm:[obm],\n-                            relations : []\n-                        };\n-\n-                        // Update existing node  or create a new one\n-                        return waterline.nodes.needOne({identifiers:data.macs})\n-                            .then(function(curNode) {\n-                                return waterline.nodes.updateOne(\n-                                    { id: curNode.id },\n-                                    node\n-                                )\n-                                .then(function(data){\n-                                    return data;\n+                        self.createNode(data, 'compute');\n+                    });\n+            }else{\n+                logger.warning('No rackmount servers found Found');\n+                return;\n+            }\n+        });\n+    };\n+\n+    /**\n+     * @function createServers\n+     * @description discovers all the chassis servers in the Cisco UCS\n+     */\n+    UcsDiscoveryJob.prototype.createServers = function (root) {","path":"lib/jobs/ucs-discovery.js","position":52,"original_position":52,"commit_id":"74d9eb18e0c021bb86374771bc86fca85bde743f","original_commit_id":"1391be726e9f905187684475b84940d757687942","user":{"login":"yyscamper","id":511378,"avatar_url":"https://avatars.githubusercontent.com/u/511378?v=3","gravatar_id":"","url":"https://api.github.com/users/yyscamper","html_url":"https://github.com/yyscamper","followers_url":"https://api.github.com/users/yyscamper/followers","following_url":"https://api.github.com/users/yyscamper/following{/other_user}","gists_url":"https://api.github.com/users/yyscamper/gists{/gist_id}","starred_url":"https://api.github.com/users/yyscamper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yyscamper/subscriptions","organizations_url":"https://api.github.com/users/yyscamper/orgs","repos_url":"https://api.github.com/users/yyscamper/repos","events_url":"https://api.github.com/users/yyscamper/events{/privacy}","received_events_url":"https://api.github.com/users/yyscamper/received_events","type":"User","site_admin":false},"body":"After examining the whole code, the cause that leads to tool meany nesting levels is that you mixed the code that creating node and updating node relations together, just split the node creation and node update to a smaller function, this function will look much more simple:\r\n","created_at":"2017-02-16T16:11:36Z","updated_at":"2017-02-16T16:11:36Z","html_url":"https://github.com/RackHD/on-tasks/pull/403#discussion_r101557527","pull_request_url":"https://api.github.com/repos/RackHD/on-tasks/pulls/403","_links":{"self":{"href":"https://api.github.com/repos/RackHD/on-tasks/pulls/comments/101557527"},"html":{"href":"https://github.com/RackHD/on-tasks/pull/403#discussion_r101557527"},"pull_request":{"href":"https://api.github.com/repos/RackHD/on-tasks/pulls/403"}}},"pull_request":{"url":"https://api.github.com/repos/RackHD/on-tasks/pulls/403","id":106200652,"html_url":"https://github.com/RackHD/on-tasks/pull/403","diff_url":"https://github.com/RackHD/on-tasks/pull/403.diff","patch_url":"https://github.com/RackHD/on-tasks/pull/403.patch","issue_url":"https://api.github.com/repos/RackHD/on-tasks/issues/403","number":403,"state":"open","locked":false,"title":"Enable discovery of UCS Chassis and Servers","user":{"login":"geoff-reid","id":14055208,"avatar_url":"https://avatars.githubusercontent.com/u/14055208?v=3","gravatar_id":"","url":"https://api.github.com/users/geoff-reid","html_url":"https://github.com/geoff-reid","followers_url":"https://api.github.com/users/geoff-reid/followers","following_url":"https://api.github.com/users/geoff-reid/following{/other_user}","gists_url":"https://api.github.com/users/geoff-reid/gists{/gist_id}","starred_url":"https://api.github.com/users/geoff-reid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoff-reid/subscriptions","organizations_url":"https://api.github.com/users/geoff-reid/orgs","repos_url":"https://api.github.com/users/geoff-reid/repos","events_url":"https://api.github.com/users/geoff-reid/events{/privacy}","received_events_url":"https://api.github.com/users/geoff-reid/received_events","type":"User","site_admin":false},"body":"@RackHD/corecommitters @tannoa2 @keedya @uppalk1 ","created_at":"2017-02-14T21:56:29Z","updated_at":"2017-02-16T16:11:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"79bdcb8e651792f837abbfa83ad4cd705b8f895e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/RackHD/on-tasks/pulls/403/commits","review_comments_url":"https://api.github.com/repos/RackHD/on-tasks/pulls/403/comments","review_comment_url":"https://api.github.com/repos/RackHD/on-tasks/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RackHD/on-tasks/issues/403/comments","statuses_url":"https://api.github.com/repos/RackHD/on-tasks/statuses/74d9eb18e0c021bb86374771bc86fca85bde743f","head":{"label":"geoff-reid:discover_chassis","ref":"discover_chassis","sha":"74d9eb18e0c021bb86374771bc86fca85bde743f","user":{"login":"geoff-reid","id":14055208,"avatar_url":"https://avatars.githubusercontent.com/u/14055208?v=3","gravatar_id":"","url":"https://api.github.com/users/geoff-reid","html_url":"https://github.com/geoff-reid","followers_url":"https://api.github.com/users/geoff-reid/followers","following_url":"https://api.github.com/users/geoff-reid/following{/other_user}","gists_url":"https://api.github.com/users/geoff-reid/gists{/gist_id}","starred_url":"https://api.github.com/users/geoff-reid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoff-reid/subscriptions","organizations_url":"https://api.github.com/users/geoff-reid/orgs","repos_url":"https://api.github.com/users/geoff-reid/repos","events_url":"https://api.github.com/users/geoff-reid/events{/privacy}","received_events_url":"https://api.github.com/users/geoff-reid/received_events","type":"User","site_admin":false},"repo":{"id":81835084,"name":"on-tasks","full_name":"geoff-reid/on-tasks","owner":{"login":"geoff-reid","id":14055208,"avatar_url":"https://avatars.githubusercontent.com/u/14055208?v=3","gravatar_id":"","url":"https://api.github.com/users/geoff-reid","html_url":"https://github.com/geoff-reid","followers_url":"https://api.github.com/users/geoff-reid/followers","following_url":"https://api.github.com/users/geoff-reid/following{/other_user}","gists_url":"https://api.github.com/users/geoff-reid/gists{/gist_id}","starred_url":"https://api.github.com/users/geoff-reid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoff-reid/subscriptions","organizations_url":"https://api.github.com/users/geoff-reid/orgs","repos_url":"https://api.github.com/users/geoff-reid/repos","events_url":"https://api.github.com/users/geoff-reid/events{/privacy}","received_events_url":"https://api.github.com/users/geoff-reid/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/geoff-reid/on-tasks","description":null,"fork":true,"url":"https://api.github.com/repos/geoff-reid/on-tasks","forks_url":"https://api.github.com/repos/geoff-reid/on-tasks/forks","keys_url":"https://api.github.com/repos/geoff-reid/on-tasks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geoff-reid/on-tasks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geoff-reid/on-tasks/teams","hooks_url":"https://api.github.com/repos/geoff-reid/on-tasks/hooks","issue_events_url":"https://api.github.com/repos/geoff-reid/on-tasks/issues/events{/number}","events_url":"https://api.github.com/repos/geoff-reid/on-tasks/events","assignees_url":"https://api.github.com/repos/geoff-reid/on-tasks/assignees{/user}","branches_url":"https://api.github.com/repos/geoff-reid/on-tasks/branches{/branch}","tags_url":"https://api.github.com/repos/geoff-reid/on-tasks/tags","blobs_url":"https://api.github.com/repos/geoff-reid/on-tasks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geoff-reid/on-tasks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geoff-reid/on-tasks/git/refs{/sha}","trees_url":"https://api.github.com/repos/geoff-reid/on-tasks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geoff-reid/on-tasks/statuses/{sha}","languages_url":"https://api.github.com/repos/geoff-reid/on-tasks/languages","stargazers_url":"https://api.github.com/repos/geoff-reid/on-tasks/stargazers","contributors_url":"https://api.github.com/repos/geoff-reid/on-tasks/contributors","subscribers_url":"https://api.github.com/repos/geoff-reid/on-tasks/subscribers","subscription_url":"https://api.github.com/repos/geoff-reid/on-tasks/subscription","commits_url":"https://api.github.com/repos/geoff-reid/on-tasks/commits{/sha}","git_commits_url":"https://api.github.com/repos/geoff-reid/on-tasks/git/commits{/sha}","comments_url":"https://api.github.com/repos/geoff-reid/on-tasks/comments{/number}","issue_comment_url":"https://api.github.com/repos/geoff-reid/on-tasks/issues/comments{/number}","contents_url":"https://api.github.com/repos/geoff-reid/on-tasks/contents/{+path}","compare_url":"https://api.github.com/repos/geoff-reid/on-tasks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geoff-reid/on-tasks/merges","archive_url":"https://api.github.com/repos/geoff-reid/on-tasks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geoff-reid/on-tasks/downloads","issues_url":"https://api.github.com/repos/geoff-reid/on-tasks/issues{/number}","pulls_url":"https://api.github.com/repos/geoff-reid/on-tasks/pulls{/number}","milestones_url":"https://api.github.com/repos/geoff-reid/on-tasks/milestones{/number}","notifications_url":"https://api.github.com/repos/geoff-reid/on-tasks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geoff-reid/on-tasks/labels{/name}","releases_url":"https://api.github.com/repos/geoff-reid/on-tasks/releases{/id}","deployments_url":"https://api.github.com/repos/geoff-reid/on-tasks/deployments","created_at":"2017-02-13T14:43:52Z","updated_at":"2017-02-13T14:43:55Z","pushed_at":"2017-02-16T15:28:51Z","git_url":"git://github.com/geoff-reid/on-tasks.git","ssh_url":"git@github.com:geoff-reid/on-tasks.git","clone_url":"https://github.com/geoff-reid/on-tasks.git","svn_url":"https://github.com/geoff-reid/on-tasks","homepage":null,"size":2005,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"RackHD:master","ref":"master","sha":"436c800e6304999b37cc269d4db6af30fe988792","user":{"login":"RackHD","id":13982662,"avatar_url":"https://avatars.githubusercontent.com/u/13982662?v=3","gravatar_id":"","url":"https://api.github.com/users/RackHD","html_url":"https://github.com/RackHD","followers_url":"https://api.github.com/users/RackHD/followers","following_url":"https://api.github.com/users/RackHD/following{/other_user}","gists_url":"https://api.github.com/users/RackHD/gists{/gist_id}","starred_url":"https://api.github.com/users/RackHD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RackHD/subscriptions","organizations_url":"https://api.github.com/users/RackHD/orgs","repos_url":"https://api.github.com/users/RackHD/repos","events_url":"https://api.github.com/users/RackHD/events{/privacy}","received_events_url":"https://api.github.com/users/RackHD/received_events","type":"Organization","site_admin":false},"repo":{"id":41690099,"name":"on-tasks","full_name":"RackHD/on-tasks","owner":{"login":"RackHD","id":13982662,"avatar_url":"https://avatars.githubusercontent.com/u/13982662?v=3","gravatar_id":"","url":"https://api.github.com/users/RackHD","html_url":"https://github.com/RackHD","followers_url":"https://api.github.com/users/RackHD/followers","following_url":"https://api.github.com/users/RackHD/following{/other_user}","gists_url":"https://api.github.com/users/RackHD/gists{/gist_id}","starred_url":"https://api.github.com/users/RackHD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RackHD/subscriptions","organizations_url":"https://api.github.com/users/RackHD/orgs","repos_url":"https://api.github.com/users/RackHD/repos","events_url":"https://api.github.com/users/RackHD/events{/privacy}","received_events_url":"https://api.github.com/users/RackHD/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RackHD/on-tasks","description":null,"fork":false,"url":"https://api.github.com/repos/RackHD/on-tasks","forks_url":"https://api.github.com/repos/RackHD/on-tasks/forks","keys_url":"https://api.github.com/repos/RackHD/on-tasks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RackHD/on-tasks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RackHD/on-tasks/teams","hooks_url":"https://api.github.com/repos/RackHD/on-tasks/hooks","issue_events_url":"https://api.github.com/repos/RackHD/on-tasks/issues/events{/number}","events_url":"https://api.github.com/repos/RackHD/on-tasks/events","assignees_url":"https://api.github.com/repos/RackHD/on-tasks/assignees{/user}","branches_url":"https://api.github.com/repos/RackHD/on-tasks/branches{/branch}","tags_url":"https://api.github.com/repos/RackHD/on-tasks/tags","blobs_url":"https://api.github.com/repos/RackHD/on-tasks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RackHD/on-tasks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RackHD/on-tasks/git/refs{/sha}","trees_url":"https://api.github.com/repos/RackHD/on-tasks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RackHD/on-tasks/statuses/{sha}","languages_url":"https://api.github.com/repos/RackHD/on-tasks/languages","stargazers_url":"https://api.github.com/repos/RackHD/on-tasks/stargazers","contributors_url":"https://api.github.com/repos/RackHD/on-tasks/contributors","subscribers_url":"https://api.github.com/repos/RackHD/on-tasks/subscribers","subscription_url":"https://api.github.com/repos/RackHD/on-tasks/subscription","commits_url":"https://api.github.com/repos/RackHD/on-tasks/commits{/sha}","git_commits_url":"https://api.github.com/repos/RackHD/on-tasks/git/commits{/sha}","comments_url":"https://api.github.com/repos/RackHD/on-tasks/comments{/number}","issue_comment_url":"https://api.github.com/repos/RackHD/on-tasks/issues/comments{/number}","contents_url":"https://api.github.com/repos/RackHD/on-tasks/contents/{+path}","compare_url":"https://api.github.com/repos/RackHD/on-tasks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RackHD/on-tasks/merges","archive_url":"https://api.github.com/repos/RackHD/on-tasks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RackHD/on-tasks/downloads","issues_url":"https://api.github.com/repos/RackHD/on-tasks/issues{/number}","pulls_url":"https://api.github.com/repos/RackHD/on-tasks/pulls{/number}","milestones_url":"https://api.github.com/repos/RackHD/on-tasks/milestones{/number}","notifications_url":"https://api.github.com/repos/RackHD/on-tasks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RackHD/on-tasks/labels{/name}","releases_url":"https://api.github.com/repos/RackHD/on-tasks/releases{/id}","deployments_url":"https://api.github.com/repos/RackHD/on-tasks/deployments","created_at":"2015-08-31T17:29:32Z","updated_at":"2016-10-25T14:42:03Z","pushed_at":"2017-02-16T15:28:53Z","git_url":"git://github.com/RackHD/on-tasks.git","ssh_url":"git@github.com:RackHD/on-tasks.git","clone_url":"https://github.com/RackHD/on-tasks.git","svn_url":"https://github.com/RackHD/on-tasks","homepage":null,"size":2003,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":56,"mirror_url":null,"open_issues_count":11,"forks":56,"open_issues":11,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RackHD/on-tasks/pulls/403"},"html":{"href":"https://github.com/RackHD/on-tasks/pull/403"},"issue":{"href":"https://api.github.com/repos/RackHD/on-tasks/issues/403"},"comments":{"href":"https://api.github.com/repos/RackHD/on-tasks/issues/403/comments"},"review_comments":{"href":"https://api.github.com/repos/RackHD/on-tasks/pulls/403/comments"},"review_comment":{"href":"https://api.github.com/repos/RackHD/on-tasks/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RackHD/on-tasks/pulls/403/commits"},"statuses":{"href":"https://api.github.com/repos/RackHD/on-tasks/statuses/74d9eb18e0c021bb86374771bc86fca85bde743f"}}}}
{"actor":{"display_login":"yyscamper"}}