{"action":"created","comment":{"url":"https://api.github.com/repos/scality/cloudserver/pulls/comments/220660508","pull_request_review_id":159120213,"id":220660508,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMDY2MDUwOA==","diff_hunk":"@@ -1,14 +1,71 @@\n+const WebSocket = require('ws');\n+const logger = require('../utilities/logger');\n+const _config = require('../Config').config;\n+const { patchConfiguration } = require('./configuration');\n+\n+\n const managementAgentMessageType = {\n     /** Message that contains the loaded overlay */\n     NEW_OVERLAY: 1,\n };\n \n+const CONNECTION_RETRY_TIMEOUT_MS = 5000;\n+\n+\n+function initManagementClient() {\n+    const host = _config.managementAgent.host;\n+    const port = _config.managementAgent.port;\n+\n+    const ws = new WebSocket(`ws://${host}:${port}/watch`);\n+\n+    ws.on('open', () => {\n+        logger.info('connected with management agent');\n+    });\n+\n+    ws.on('close', (code, reason) => {\n+        logger.info('disconnected from management agent', { reason });\n+        setTimeout(initManagementClient, CONNECTION_RETRY_TIMEOUT_MS);\n+    });\n+\n+    ws.on('error', error => {\n+        logger.error('error on connection with management agent', { error });\n+    });\n+\n+    ws.on('message', data => {\n+        const log = logger.newRequestLogger();\n+        const msg = JSON.parse(data);\n+\n+        if (msg.payload === undefined) {\n+            log.error('message without payload');\n+            return;\n+        }\n+        if (typeof msg.messageType !== 'number') {\n+            log.error('messageType is not an integer', {\n+                type: typeof msg.messageType,\n+            });\n+            return;\n+        }\n+\n+        switch (msg.messageType) {\n+        case managementAgentMessageType.NEW_OVERLAY:\n+            patchConfiguration(msg.payload, log, err => {\n+                if (err) { log.error('failed to patch overlay', { err }); }\n+            });\n+            break;","path":"lib/management/agentClient.js","position":54,"original_position":54,"commit_id":"c9d3d3c400aea0e71e3f9f2ddbbb7feefc0e9f12","original_commit_id":"c9d3d3c400aea0e71e3f9f2ddbbb7feefc0e9f12","user":{"login":"jeremyds","id":5263687,"node_id":"MDQ6VXNlcjUyNjM2ODc=","avatar_url":"https://avatars2.githubusercontent.com/u/5263687?v=4","gravatar_id":"","url":"https://api.github.com/users/jeremyds","html_url":"https://github.com/jeremyds","followers_url":"https://api.github.com/users/jeremyds/followers","following_url":"https://api.github.com/users/jeremyds/following{/other_user}","gists_url":"https://api.github.com/users/jeremyds/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremyds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremyds/subscriptions","organizations_url":"https://api.github.com/users/jeremyds/orgs","repos_url":"https://api.github.com/users/jeremyds/repos","events_url":"https://api.github.com/users/jeremyds/events{/privacy}","received_events_url":"https://api.github.com/users/jeremyds/received_events","type":"User","site_admin":false},"body":"you re right, done","created_at":"2018-09-26T17:47:33Z","updated_at":"2018-09-26T17:47:33Z","html_url":"https://github.com/scality/cloudserver/pull/1542#discussion_r220660508","pull_request_url":"https://api.github.com/repos/scality/cloudserver/pulls/1542","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/scality/cloudserver/pulls/comments/220660508"},"html":{"href":"https://github.com/scality/cloudserver/pull/1542#discussion_r220660508"},"pull_request":{"href":"https://api.github.com/repos/scality/cloudserver/pulls/1542"}},"in_reply_to_id":220658146},"pull_request":{"url":"https://api.github.com/repos/scality/cloudserver/pulls/1542","id":215419718,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1NDE5NzE4","html_url":"https://github.com/scality/cloudserver/pull/1542","diff_url":"https://github.com/scality/cloudserver/pull/1542.diff","patch_url":"https://github.com/scality/cloudserver/pull/1542.patch","issue_url":"https://api.github.com/repos/scality/cloudserver/issues/1542","number":1542,"state":"open","locked":false,"title":"Feature/zenko 714 s3 management code2","user":{"login":"jeremyds","id":5263687,"node_id":"MDQ6VXNlcjUyNjM2ODc=","avatar_url":"https://avatars2.githubusercontent.com/u/5263687?v=4","gravatar_id":"","url":"https://api.github.com/users/jeremyds","html_url":"https://github.com/jeremyds","followers_url":"https://api.github.com/users/jeremyds/followers","following_url":"https://api.github.com/users/jeremyds/following{/other_user}","gists_url":"https://api.github.com/users/jeremyds/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremyds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremyds/subscriptions","organizations_url":"https://api.github.com/users/jeremyds/orgs","repos_url":"https://api.github.com/users/jeremyds/repos","events_url":"https://api.github.com/users/jeremyds/events{/privacy}","received_events_url":"https://api.github.com/users/jeremyds/received_events","type":"User","site_admin":false},"body":"# Pull request template\r\n\r\n## Description\r\n\r\n### Motivation and context\r\n\r\nWhy is this change required? What problem does it solve?\r\n\r\n### Related issues\r\n\r\nPlease use the following link syntaxes #600 to reference issues in the\r\ncurrent repository\r\n\r\n## Checklist\r\n\r\n### Add tests to cover the changes\r\n\r\nNew tests added or existing tests modified to cover all changes\r\n\r\n### Code conforms with the [style guide](https://github.com/scality/Guidelines/blob/master/CONTRIBUTING.md#coding-style-guidelines)\r\n\r\n### Sign your work\r\n\r\nIn order to contribute to the project, you must sign your work\r\nhttps://github.com/scality/Guidelines/blob/master/CONTRIBUTING.md#sign-your-work\r\n\r\nThank you again for contributing! We will try to test and integrate the change\r\nas soon as we can.\r\n","created_at":"2018-09-13T21:20:25Z","updated_at":"2018-09-26T17:47:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ed554c25117eb84338ce1a8f8864fb53d2707b3f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/scality/cloudserver/pulls/1542/commits","review_comments_url":"https://api.github.com/repos/scality/cloudserver/pulls/1542/comments","review_comment_url":"https://api.github.com/repos/scality/cloudserver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scality/cloudserver/issues/1542/comments","statuses_url":"https://api.github.com/repos/scality/cloudserver/statuses/c9d3d3c400aea0e71e3f9f2ddbbb7feefc0e9f12","head":{"label":"scality:feature/ZENKO-714-s3-management-code2","ref":"feature/ZENKO-714-s3-management-code2","sha":"c9d3d3c400aea0e71e3f9f2ddbbb7feefc0e9f12","user":{"login":"scality","id":383812,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4MzgxMg==","avatar_url":"https://avatars1.githubusercontent.com/u/383812?v=4","gravatar_id":"","url":"https://api.github.com/users/scality","html_url":"https://github.com/scality","followers_url":"https://api.github.com/users/scality/followers","following_url":"https://api.github.com/users/scality/following{/other_user}","gists_url":"https://api.github.com/users/scality/gists{/gist_id}","starred_url":"https://api.github.com/users/scality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scality/subscriptions","organizations_url":"https://api.github.com/users/scality/orgs","repos_url":"https://api.github.com/users/scality/repos","events_url":"https://api.github.com/users/scality/events{/privacy}","received_events_url":"https://api.github.com/users/scality/received_events","type":"Organization","site_admin":false},"repo":{"id":60165924,"node_id":"MDEwOlJlcG9zaXRvcnk2MDE2NTkyNA==","name":"cloudserver","full_name":"scality/cloudserver","private":false,"owner":{"login":"scality","id":383812,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4MzgxMg==","avatar_url":"https://avatars1.githubusercontent.com/u/383812?v=4","gravatar_id":"","url":"https://api.github.com/users/scality","html_url":"https://github.com/scality","followers_url":"https://api.github.com/users/scality/followers","following_url":"https://api.github.com/users/scality/following{/other_user}","gists_url":"https://api.github.com/users/scality/gists{/gist_id}","starred_url":"https://api.github.com/users/scality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scality/subscriptions","organizations_url":"https://api.github.com/users/scality/orgs","repos_url":"https://api.github.com/users/scality/repos","events_url":"https://api.github.com/users/scality/events{/privacy}","received_events_url":"https://api.github.com/users/scality/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/scality/cloudserver","description":"Zenko CloudServer, an open-source Node.js implementation of the Amazon S3 protocol on the front-end and backend storage capabilities to multiple clouds, including Azure and Google.","fork":false,"url":"https://api.github.com/repos/scality/cloudserver","forks_url":"https://api.github.com/repos/scality/cloudserver/forks","keys_url":"https://api.github.com/repos/scality/cloudserver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scality/cloudserver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scality/cloudserver/teams","hooks_url":"https://api.github.com/repos/scality/cloudserver/hooks","issue_events_url":"https://api.github.com/repos/scality/cloudserver/issues/events{/number}","events_url":"https://api.github.com/repos/scality/cloudserver/events","assignees_url":"https://api.github.com/repos/scality/cloudserver/assignees{/user}","branches_url":"https://api.github.com/repos/scality/cloudserver/branches{/branch}","tags_url":"https://api.github.com/repos/scality/cloudserver/tags","blobs_url":"https://api.github.com/repos/scality/cloudserver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scality/cloudserver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scality/cloudserver/git/refs{/sha}","trees_url":"https://api.github.com/repos/scality/cloudserver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scality/cloudserver/statuses/{sha}","languages_url":"https://api.github.com/repos/scality/cloudserver/languages","stargazers_url":"https://api.github.com/repos/scality/cloudserver/stargazers","contributors_url":"https://api.github.com/repos/scality/cloudserver/contributors","subscribers_url":"https://api.github.com/repos/scality/cloudserver/subscribers","subscription_url":"https://api.github.com/repos/scality/cloudserver/subscription","commits_url":"https://api.github.com/repos/scality/cloudserver/commits{/sha}","git_commits_url":"https://api.github.com/repos/scality/cloudserver/git/commits{/sha}","comments_url":"https://api.github.com/repos/scality/cloudserver/comments{/number}","issue_comment_url":"https://api.github.com/repos/scality/cloudserver/issues/comments{/number}","contents_url":"https://api.github.com/repos/scality/cloudserver/contents/{+path}","compare_url":"https://api.github.com/repos/scality/cloudserver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scality/cloudserver/merges","archive_url":"https://api.github.com/repos/scality/cloudserver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scality/cloudserver/downloads","issues_url":"https://api.github.com/repos/scality/cloudserver/issues{/number}","pulls_url":"https://api.github.com/repos/scality/cloudserver/pulls{/number}","milestones_url":"https://api.github.com/repos/scality/cloudserver/milestones{/number}","notifications_url":"https://api.github.com/repos/scality/cloudserver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scality/cloudserver/labels{/name}","releases_url":"https://api.github.com/repos/scality/cloudserver/releases{/id}","deployments_url":"https://api.github.com/repos/scality/cloudserver/deployments","created_at":"2016-06-01T09:58:56Z","updated_at":"2018-09-25T10:59:56Z","pushed_at":"2018-09-26T17:36:37Z","git_url":"git://github.com/scality/cloudserver.git","ssh_url":"git@github.com:scality/cloudserver.git","clone_url":"https://github.com/scality/cloudserver.git","svn_url":"https://github.com/scality/cloudserver","homepage":"https://www.zenko.io/cloudserver","size":34911,"stargazers_count":750,"watchers_count":750,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":145,"mirror_url":null,"archived":false,"open_issues_count":51,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":145,"open_issues":51,"watchers":750,"default_branch":"development/8.0"}},"base":{"label":"scality:development/8.1","ref":"development/8.1","sha":"4f30e62279d59d3c240838beafb9a8dda56105f3","user":{"login":"scality","id":383812,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4MzgxMg==","avatar_url":"https://avatars1.githubusercontent.com/u/383812?v=4","gravatar_id":"","url":"https://api.github.com/users/scality","html_url":"https://github.com/scality","followers_url":"https://api.github.com/users/scality/followers","following_url":"https://api.github.com/users/scality/following{/other_user}","gists_url":"https://api.github.com/users/scality/gists{/gist_id}","starred_url":"https://api.github.com/users/scality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scality/subscriptions","organizations_url":"https://api.github.com/users/scality/orgs","repos_url":"https://api.github.com/users/scality/repos","events_url":"https://api.github.com/users/scality/events{/privacy}","received_events_url":"https://api.github.com/users/scality/received_events","type":"Organization","site_admin":false},"repo":{"id":60165924,"node_id":"MDEwOlJlcG9zaXRvcnk2MDE2NTkyNA==","name":"cloudserver","full_name":"scality/cloudserver","private":false,"owner":{"login":"scality","id":383812,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4MzgxMg==","avatar_url":"https://avatars1.githubusercontent.com/u/383812?v=4","gravatar_id":"","url":"https://api.github.com/users/scality","html_url":"https://github.com/scality","followers_url":"https://api.github.com/users/scality/followers","following_url":"https://api.github.com/users/scality/following{/other_user}","gists_url":"https://api.github.com/users/scality/gists{/gist_id}","starred_url":"https://api.github.com/users/scality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scality/subscriptions","organizations_url":"https://api.github.com/users/scality/orgs","repos_url":"https://api.github.com/users/scality/repos","events_url":"https://api.github.com/users/scality/events{/privacy}","received_events_url":"https://api.github.com/users/scality/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/scality/cloudserver","description":"Zenko CloudServer, an open-source Node.js implementation of the Amazon S3 protocol on the front-end and backend storage capabilities to multiple clouds, including Azure and Google.","fork":false,"url":"https://api.github.com/repos/scality/cloudserver","forks_url":"https://api.github.com/repos/scality/cloudserver/forks","keys_url":"https://api.github.com/repos/scality/cloudserver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scality/cloudserver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scality/cloudserver/teams","hooks_url":"https://api.github.com/repos/scality/cloudserver/hooks","issue_events_url":"https://api.github.com/repos/scality/cloudserver/issues/events{/number}","events_url":"https://api.github.com/repos/scality/cloudserver/events","assignees_url":"https://api.github.com/repos/scality/cloudserver/assignees{/user}","branches_url":"https://api.github.com/repos/scality/cloudserver/branches{/branch}","tags_url":"https://api.github.com/repos/scality/cloudserver/tags","blobs_url":"https://api.github.com/repos/scality/cloudserver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scality/cloudserver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scality/cloudserver/git/refs{/sha}","trees_url":"https://api.github.com/repos/scality/cloudserver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scality/cloudserver/statuses/{sha}","languages_url":"https://api.github.com/repos/scality/cloudserver/languages","stargazers_url":"https://api.github.com/repos/scality/cloudserver/stargazers","contributors_url":"https://api.github.com/repos/scality/cloudserver/contributors","subscribers_url":"https://api.github.com/repos/scality/cloudserver/subscribers","subscription_url":"https://api.github.com/repos/scality/cloudserver/subscription","commits_url":"https://api.github.com/repos/scality/cloudserver/commits{/sha}","git_commits_url":"https://api.github.com/repos/scality/cloudserver/git/commits{/sha}","comments_url":"https://api.github.com/repos/scality/cloudserver/comments{/number}","issue_comment_url":"https://api.github.com/repos/scality/cloudserver/issues/comments{/number}","contents_url":"https://api.github.com/repos/scality/cloudserver/contents/{+path}","compare_url":"https://api.github.com/repos/scality/cloudserver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scality/cloudserver/merges","archive_url":"https://api.github.com/repos/scality/cloudserver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scality/cloudserver/downloads","issues_url":"https://api.github.com/repos/scality/cloudserver/issues{/number}","pulls_url":"https://api.github.com/repos/scality/cloudserver/pulls{/number}","milestones_url":"https://api.github.com/repos/scality/cloudserver/milestones{/number}","notifications_url":"https://api.github.com/repos/scality/cloudserver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scality/cloudserver/labels{/name}","releases_url":"https://api.github.com/repos/scality/cloudserver/releases{/id}","deployments_url":"https://api.github.com/repos/scality/cloudserver/deployments","created_at":"2016-06-01T09:58:56Z","updated_at":"2018-09-25T10:59:56Z","pushed_at":"2018-09-26T17:36:37Z","git_url":"git://github.com/scality/cloudserver.git","ssh_url":"git@github.com:scality/cloudserver.git","clone_url":"https://github.com/scality/cloudserver.git","svn_url":"https://github.com/scality/cloudserver","homepage":"https://www.zenko.io/cloudserver","size":34911,"stargazers_count":750,"watchers_count":750,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":145,"mirror_url":null,"archived":false,"open_issues_count":51,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":145,"open_issues":51,"watchers":750,"default_branch":"development/8.0"}},"_links":{"self":{"href":"https://api.github.com/repos/scality/cloudserver/pulls/1542"},"html":{"href":"https://github.com/scality/cloudserver/pull/1542"},"issue":{"href":"https://api.github.com/repos/scality/cloudserver/issues/1542"},"comments":{"href":"https://api.github.com/repos/scality/cloudserver/issues/1542/comments"},"review_comments":{"href":"https://api.github.com/repos/scality/cloudserver/pulls/1542/comments"},"review_comment":{"href":"https://api.github.com/repos/scality/cloudserver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scality/cloudserver/pulls/1542/commits"},"statuses":{"href":"https://api.github.com/repos/scality/cloudserver/statuses/c9d3d3c400aea0e71e3f9f2ddbbb7feefc0e9f12"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jeremyds"}}