{"action":"created","comment":{"url":"https://api.github.com/repos/Linaro/mr-provisioner-client/pulls/comments/226287380","pull_request_review_id":166070009,"id":226287380,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNjI4NzM4MA==","diff_hunk":"@@ -0,0 +1,52 @@\n+#!/usr/bin/env python3\n+# -*- coding: utf-8 -*-\n+\n+import ipaddress\n+\n+from library.common import *\n+from urllib.parse import quote\n+\n+class NetworkControl(object):\n+    def __init__(self, urlhandler, machine_id, interface_name):\n+        self.urlhandler = urlhandler\n+        self.machine_id = machine_id\n+        self.interface = self.get_interface(interface_name)\n+\n+    def get_network_info(self, command):\n+        if command == 'getip':\n+            return self.get_ip()\n+        elif command == 'getmac':\n+            return self.get_mac()\n+        elif command == 'getnetmask':\n+            return self.get_netmask()\n+        else:\n+            raise LookupError(\"Unknown Command : %s\" % command)\n+\n+    def get_interface(self, interface_name):\n+        url = \"/api/v1/machine/{}/interface\".format(self.machine_id)\n+        interfaces = self.urlhandler.get(url)\n+\n+        if not interfaces:\n+            raise ProvisionerError(\"No interfaces for machine id %s\" %\n+                                   self.machine_id)\n+\n+        for i in interfaces:\n+            if 'identifier' in i and str(i['identifier']) == interface_name:\n+                return i\n+            else:","path":"library/NetworkControl.py","position":36,"original_position":36,"commit_id":"dc17bae75e1eb7362895bde44560184c212d2edc","original_commit_id":"dc17bae75e1eb7362895bde44560184c212d2edc","user":{"login":"rengolin","id":1040968,"node_id":"MDQ6VXNlcjEwNDA5Njg=","avatar_url":"https://avatars0.githubusercontent.com/u/1040968?v=4","gravatar_id":"","url":"https://api.github.com/users/rengolin","html_url":"https://github.com/rengolin","followers_url":"https://api.github.com/users/rengolin/followers","following_url":"https://api.github.com/users/rengolin/following{/other_user}","gists_url":"https://api.github.com/users/rengolin/gists{/gist_id}","starred_url":"https://api.github.com/users/rengolin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rengolin/subscriptions","organizations_url":"https://api.github.com/users/rengolin/orgs","repos_url":"https://api.github.com/users/rengolin/repos","events_url":"https://api.github.com/users/rengolin/events{/privacy}","received_events_url":"https://api.github.com/users/rengolin/received_events","type":"User","site_admin":false},"body":"This forces the interfaces to be the first ones. You don't need the else, just let it fall to the last raise.","created_at":"2018-10-18T12:39:29Z","updated_at":"2018-10-18T12:41:20Z","html_url":"https://github.com/Linaro/mr-provisioner-client/pull/6#discussion_r226287380","pull_request_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/pulls/6","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Linaro/mr-provisioner-client/pulls/comments/226287380"},"html":{"href":"https://github.com/Linaro/mr-provisioner-client/pull/6#discussion_r226287380"},"pull_request":{"href":"https://api.github.com/repos/Linaro/mr-provisioner-client/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/Linaro/mr-provisioner-client/pulls/6","id":222899524,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyODk5NTI0","html_url":"https://github.com/Linaro/mr-provisioner-client/pull/6","diff_url":"https://github.com/Linaro/mr-provisioner-client/pull/6.diff","patch_url":"https://github.com/Linaro/mr-provisioner-client/pull/6.patch","issue_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/issues/6","number":6,"state":"open","locked":false,"title":"Reworked get_ip into NetworkControl","user":{"login":"BaptisteGerondeau","id":15145523,"node_id":"MDQ6VXNlcjE1MTQ1NTIz","avatar_url":"https://avatars3.githubusercontent.com/u/15145523?v=4","gravatar_id":"","url":"https://api.github.com/users/BaptisteGerondeau","html_url":"https://github.com/BaptisteGerondeau","followers_url":"https://api.github.com/users/BaptisteGerondeau/followers","following_url":"https://api.github.com/users/BaptisteGerondeau/following{/other_user}","gists_url":"https://api.github.com/users/BaptisteGerondeau/gists{/gist_id}","starred_url":"https://api.github.com/users/BaptisteGerondeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaptisteGerondeau/subscriptions","organizations_url":"https://api.github.com/users/BaptisteGerondeau/orgs","repos_url":"https://api.github.com/users/BaptisteGerondeau/repos","events_url":"https://api.github.com/users/BaptisteGerondeau/events{/privacy}","received_events_url":"https://api.github.com/users/BaptisteGerondeau/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-15T13:07:46Z","updated_at":"2018-10-18T12:41:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5f47c19f1b343859d2918654adddf1ca6c595cb4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/pulls/6/commits","review_comments_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/pulls/6/comments","review_comment_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/issues/6/comments","statuses_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/statuses/dc17bae75e1eb7362895bde44560184c212d2edc","head":{"label":"BaptisteGerondeau:networkcontrol","ref":"networkcontrol","sha":"dc17bae75e1eb7362895bde44560184c212d2edc","user":{"login":"BaptisteGerondeau","id":15145523,"node_id":"MDQ6VXNlcjE1MTQ1NTIz","avatar_url":"https://avatars3.githubusercontent.com/u/15145523?v=4","gravatar_id":"","url":"https://api.github.com/users/BaptisteGerondeau","html_url":"https://github.com/BaptisteGerondeau","followers_url":"https://api.github.com/users/BaptisteGerondeau/followers","following_url":"https://api.github.com/users/BaptisteGerondeau/following{/other_user}","gists_url":"https://api.github.com/users/BaptisteGerondeau/gists{/gist_id}","starred_url":"https://api.github.com/users/BaptisteGerondeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaptisteGerondeau/subscriptions","organizations_url":"https://api.github.com/users/BaptisteGerondeau/orgs","repos_url":"https://api.github.com/users/BaptisteGerondeau/repos","events_url":"https://api.github.com/users/BaptisteGerondeau/events{/privacy}","received_events_url":"https://api.github.com/users/BaptisteGerondeau/received_events","type":"User","site_admin":false},"repo":{"id":133936391,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM5MzYzOTE=","name":"mr-provisioner-client","full_name":"BaptisteGerondeau/mr-provisioner-client","private":false,"owner":{"login":"BaptisteGerondeau","id":15145523,"node_id":"MDQ6VXNlcjE1MTQ1NTIz","avatar_url":"https://avatars3.githubusercontent.com/u/15145523?v=4","gravatar_id":"","url":"https://api.github.com/users/BaptisteGerondeau","html_url":"https://github.com/BaptisteGerondeau","followers_url":"https://api.github.com/users/BaptisteGerondeau/followers","following_url":"https://api.github.com/users/BaptisteGerondeau/following{/other_user}","gists_url":"https://api.github.com/users/BaptisteGerondeau/gists{/gist_id}","starred_url":"https://api.github.com/users/BaptisteGerondeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaptisteGerondeau/subscriptions","organizations_url":"https://api.github.com/users/BaptisteGerondeau/orgs","repos_url":"https://api.github.com/users/BaptisteGerondeau/repos","events_url":"https://api.github.com/users/BaptisteGerondeau/events{/privacy}","received_events_url":"https://api.github.com/users/BaptisteGerondeau/received_events","type":"User","site_admin":false},"html_url":"https://github.com/BaptisteGerondeau/mr-provisioner-client","description":"Python library to use Mr-Provisioner's API","fork":true,"url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client","forks_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/forks","keys_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/teams","hooks_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/hooks","issue_events_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/issues/events{/number}","events_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/events","assignees_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/assignees{/user}","branches_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/branches{/branch}","tags_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/tags","blobs_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/statuses/{sha}","languages_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/languages","stargazers_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/stargazers","contributors_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/contributors","subscribers_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/subscribers","subscription_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/subscription","commits_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/contents/{+path}","compare_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/merges","archive_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/downloads","issues_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/issues{/number}","pulls_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/pulls{/number}","milestones_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/milestones{/number}","notifications_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/labels{/name}","releases_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/releases{/id}","deployments_url":"https://api.github.com/repos/BaptisteGerondeau/mr-provisioner-client/deployments","created_at":"2018-05-18T09:54:17Z","updated_at":"2018-10-18T08:59:47Z","pushed_at":"2018-10-18T09:01:48Z","git_url":"git://github.com/BaptisteGerondeau/mr-provisioner-client.git","ssh_url":"git@github.com:BaptisteGerondeau/mr-provisioner-client.git","clone_url":"https://github.com/BaptisteGerondeau/mr-provisioner-client.git","svn_url":"https://github.com/BaptisteGerondeau/mr-provisioner-client","homepage":null,"size":55,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"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":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Linaro:master","ref":"master","sha":"d674306b21fbb058c6657b6010f1543c41d550a4","user":{"login":"Linaro","id":1180626,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExODA2MjY=","avatar_url":"https://avatars0.githubusercontent.com/u/1180626?v=4","gravatar_id":"","url":"https://api.github.com/users/Linaro","html_url":"https://github.com/Linaro","followers_url":"https://api.github.com/users/Linaro/followers","following_url":"https://api.github.com/users/Linaro/following{/other_user}","gists_url":"https://api.github.com/users/Linaro/gists{/gist_id}","starred_url":"https://api.github.com/users/Linaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Linaro/subscriptions","organizations_url":"https://api.github.com/users/Linaro/orgs","repos_url":"https://api.github.com/users/Linaro/repos","events_url":"https://api.github.com/users/Linaro/events{/privacy}","received_events_url":"https://api.github.com/users/Linaro/received_events","type":"Organization","site_admin":false},"repo":{"id":133865987,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM4NjU5ODc=","name":"mr-provisioner-client","full_name":"Linaro/mr-provisioner-client","private":false,"owner":{"login":"Linaro","id":1180626,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExODA2MjY=","avatar_url":"https://avatars0.githubusercontent.com/u/1180626?v=4","gravatar_id":"","url":"https://api.github.com/users/Linaro","html_url":"https://github.com/Linaro","followers_url":"https://api.github.com/users/Linaro/followers","following_url":"https://api.github.com/users/Linaro/following{/other_user}","gists_url":"https://api.github.com/users/Linaro/gists{/gist_id}","starred_url":"https://api.github.com/users/Linaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Linaro/subscriptions","organizations_url":"https://api.github.com/users/Linaro/orgs","repos_url":"https://api.github.com/users/Linaro/repos","events_url":"https://api.github.com/users/Linaro/events{/privacy}","received_events_url":"https://api.github.com/users/Linaro/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Linaro/mr-provisioner-client","description":"Python library to use Mr-Provisioner's API","fork":false,"url":"https://api.github.com/repos/Linaro/mr-provisioner-client","forks_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/forks","keys_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/teams","hooks_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/hooks","issue_events_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/issues/events{/number}","events_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/events","assignees_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/assignees{/user}","branches_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/branches{/branch}","tags_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/tags","blobs_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/statuses/{sha}","languages_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/languages","stargazers_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/stargazers","contributors_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/contributors","subscribers_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/subscribers","subscription_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/subscription","commits_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/contents/{+path}","compare_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/merges","archive_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/downloads","issues_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/issues{/number}","pulls_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/pulls{/number}","milestones_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/milestones{/number}","notifications_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/labels{/name}","releases_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/releases{/id}","deployments_url":"https://api.github.com/repos/Linaro/mr-provisioner-client/deployments","created_at":"2018-05-17T20:37:45Z","updated_at":"2018-10-17T18:30:45Z","pushed_at":"2018-10-18T09:01:50Z","git_url":"git://github.com/Linaro/mr-provisioner-client.git","ssh_url":"git@github.com:Linaro/mr-provisioner-client.git","clone_url":"https://github.com/Linaro/mr-provisioner-client.git","svn_url":"https://github.com/Linaro/mr-provisioner-client","homepage":null,"size":25,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":5,"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":2,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Linaro/mr-provisioner-client/pulls/6"},"html":{"href":"https://github.com/Linaro/mr-provisioner-client/pull/6"},"issue":{"href":"https://api.github.com/repos/Linaro/mr-provisioner-client/issues/6"},"comments":{"href":"https://api.github.com/repos/Linaro/mr-provisioner-client/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/Linaro/mr-provisioner-client/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/Linaro/mr-provisioner-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Linaro/mr-provisioner-client/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/Linaro/mr-provisioner-client/statuses/dc17bae75e1eb7362895bde44560184c212d2edc"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"rengolin"}}