{"action":"created","comment":{"url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/comments/37124781","id":37124781,"diff_hunk":"@@ -147,6 +157,118 @@ def _configure_interface(self):\n         print('Finished configuring network interface')\n         return ep\n \n+    def _container_add(self, pid, ip, interface, hostname, orchestrator_id):\n+        \"\"\"\n+        Add a container (on this host) to Calico networking with the given IP.\n+        \"\"\"\n+        # Check if the container already exists. If it does, exit.\n+        try:\n+            _ = self._datastore_client.get_endpoint(\n+                hostname=hostname,\n+                orchestrator_id=orchestrator_id,\n+                workload_id=self.docker_id\n+            )\n+        except KeyError:\n+            # Calico doesn't know about this container.  Continue.\n+            pass\n+        else:\n+            print(\"This container has already been configured with Calico Networking.\")\n+            sys.exit(1)\n+\n+        # Obtain information from Docker Client and validate container state\n+        self._validate_container_state(self.docker_id)\n+\n+        # Assign ip address through IPAM Client\n+        try:\n+            ip_assigned = self._datastore_client.assign_address(None, ip)\n+        except PoolNotFound:\n+            print \"ERROR: IP address %s does not belong to any configured pools.\"\\\n+                  \" Exiting.\" % ip\n+            sys.exit(1)\n+        else:\n+            if ip_assigned is False:\n+               print \"ERROR: Failed to assign IP address %s. Exiting.\" % ip","path":"calico_kubernetes/calico_kubernetes.py","position":100,"original_position":100,"commit_id":"1a284da2fa554e0277b783514b216f0e07bae336","original_commit_id":"1a284da2fa554e0277b783514b216f0e07bae336","user":{"login":"caseydavenport","id":1944093,"avatar_url":"https://avatars.githubusercontent.com/u/1944093?v=3","gravatar_id":"","url":"https://api.github.com/users/caseydavenport","html_url":"https://github.com/caseydavenport","followers_url":"https://api.github.com/users/caseydavenport/followers","following_url":"https://api.github.com/users/caseydavenport/following{/other_user}","gists_url":"https://api.github.com/users/caseydavenport/gists{/gist_id}","starred_url":"https://api.github.com/users/caseydavenport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caseydavenport/subscriptions","organizations_url":"https://api.github.com/users/caseydavenport/orgs","repos_url":"https://api.github.com/users/caseydavenport/repos","events_url":"https://api.github.com/users/caseydavenport/events{/privacy}","received_events_url":"https://api.github.com/users/caseydavenport/received_events","type":"User","site_admin":false},"body":"Still missing an exit here..","created_at":"2015-08-14T22:17:57Z","updated_at":"2015-08-14T22:17:57Z","html_url":"https://github.com/projectcalico/calico-kubernetes/pull/6#discussion_r37124781","pull_request_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/comments/37124781"},"html":{"href":"https://github.com/projectcalico/calico-kubernetes/pull/6#discussion_r37124781"},"pull_request":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/6","id":41731554,"html_url":"https://github.com/projectcalico/calico-kubernetes/pull/6","diff_url":"https://github.com/projectcalico/calico-kubernetes/pull/6.diff","patch_url":"https://github.com/projectcalico/calico-kubernetes/pull/6.patch","issue_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues/6","number":6,"state":"open","locked":false,"title":"Replace calicoctl container methods","user":{"login":"L-MA","id":9704719,"avatar_url":"https://avatars.githubusercontent.com/u/9704719?v=3","gravatar_id":"","url":"https://api.github.com/users/L-MA","html_url":"https://github.com/L-MA","followers_url":"https://api.github.com/users/L-MA/followers","following_url":"https://api.github.com/users/L-MA/following{/other_user}","gists_url":"https://api.github.com/users/L-MA/gists{/gist_id}","starred_url":"https://api.github.com/users/L-MA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/L-MA/subscriptions","organizations_url":"https://api.github.com/users/L-MA/orgs","repos_url":"https://api.github.com/users/L-MA/repos","events_url":"https://api.github.com/users/L-MA/events{/privacy}","received_events_url":"https://api.github.com/users/L-MA/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-05T22:02:43Z","updated_at":"2015-08-14T22:17:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b6564a8597b01f7603d39ff90ccdf6982264c7b4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/6/commits","review_comments_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/6/comments","review_comment_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues/6/comments","statuses_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/statuses/1a284da2fa554e0277b783514b216f0e07bae336","head":{"label":"L-MA:calicoctl_container_methods","ref":"calicoctl_container_methods","sha":"1a284da2fa554e0277b783514b216f0e07bae336","user":{"login":"L-MA","id":9704719,"avatar_url":"https://avatars.githubusercontent.com/u/9704719?v=3","gravatar_id":"","url":"https://api.github.com/users/L-MA","html_url":"https://github.com/L-MA","followers_url":"https://api.github.com/users/L-MA/followers","following_url":"https://api.github.com/users/L-MA/following{/other_user}","gists_url":"https://api.github.com/users/L-MA/gists{/gist_id}","starred_url":"https://api.github.com/users/L-MA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/L-MA/subscriptions","organizations_url":"https://api.github.com/users/L-MA/orgs","repos_url":"https://api.github.com/users/L-MA/repos","events_url":"https://api.github.com/users/L-MA/events{/privacy}","received_events_url":"https://api.github.com/users/L-MA/received_events","type":"User","site_admin":false},"repo":{"id":40022933,"name":"calico-kubernetes","full_name":"L-MA/calico-kubernetes","owner":{"login":"L-MA","id":9704719,"avatar_url":"https://avatars.githubusercontent.com/u/9704719?v=3","gravatar_id":"","url":"https://api.github.com/users/L-MA","html_url":"https://github.com/L-MA","followers_url":"https://api.github.com/users/L-MA/followers","following_url":"https://api.github.com/users/L-MA/following{/other_user}","gists_url":"https://api.github.com/users/L-MA/gists{/gist_id}","starred_url":"https://api.github.com/users/L-MA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/L-MA/subscriptions","organizations_url":"https://api.github.com/users/L-MA/orgs","repos_url":"https://api.github.com/users/L-MA/repos","events_url":"https://api.github.com/users/L-MA/events{/privacy}","received_events_url":"https://api.github.com/users/L-MA/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/L-MA/calico-kubernetes","description":"","fork":true,"url":"https://api.github.com/repos/L-MA/calico-kubernetes","forks_url":"https://api.github.com/repos/L-MA/calico-kubernetes/forks","keys_url":"https://api.github.com/repos/L-MA/calico-kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/L-MA/calico-kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/L-MA/calico-kubernetes/teams","hooks_url":"https://api.github.com/repos/L-MA/calico-kubernetes/hooks","issue_events_url":"https://api.github.com/repos/L-MA/calico-kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/L-MA/calico-kubernetes/events","assignees_url":"https://api.github.com/repos/L-MA/calico-kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/L-MA/calico-kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/L-MA/calico-kubernetes/tags","blobs_url":"https://api.github.com/repos/L-MA/calico-kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/L-MA/calico-kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/L-MA/calico-kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/L-MA/calico-kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/L-MA/calico-kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/L-MA/calico-kubernetes/languages","stargazers_url":"https://api.github.com/repos/L-MA/calico-kubernetes/stargazers","contributors_url":"https://api.github.com/repos/L-MA/calico-kubernetes/contributors","subscribers_url":"https://api.github.com/repos/L-MA/calico-kubernetes/subscribers","subscription_url":"https://api.github.com/repos/L-MA/calico-kubernetes/subscription","commits_url":"https://api.github.com/repos/L-MA/calico-kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/L-MA/calico-kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/L-MA/calico-kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/L-MA/calico-kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/L-MA/calico-kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/L-MA/calico-kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/L-MA/calico-kubernetes/merges","archive_url":"https://api.github.com/repos/L-MA/calico-kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/L-MA/calico-kubernetes/downloads","issues_url":"https://api.github.com/repos/L-MA/calico-kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/L-MA/calico-kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/L-MA/calico-kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/L-MA/calico-kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/L-MA/calico-kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/L-MA/calico-kubernetes/releases{/id}","created_at":"2015-07-31T20:08:59Z","updated_at":"2015-07-29T20:04:46Z","pushed_at":"2015-08-14T22:12:07Z","git_url":"git://github.com/L-MA/calico-kubernetes.git","ssh_url":"git@github.com:L-MA/calico-kubernetes.git","clone_url":"https://github.com/L-MA/calico-kubernetes.git","svn_url":"https://github.com/L-MA/calico-kubernetes","homepage":null,"size":186,"stargazers_count":0,"watchers_count":0,"language":null,"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":"projectcalico:master","ref":"master","sha":"2e4dd0167f8d57e8704ceeebeeb45135c0308ca0","user":{"login":"projectcalico","id":12304728,"avatar_url":"https://avatars.githubusercontent.com/u/12304728?v=3","gravatar_id":"","url":"https://api.github.com/users/projectcalico","html_url":"https://github.com/projectcalico","followers_url":"https://api.github.com/users/projectcalico/followers","following_url":"https://api.github.com/users/projectcalico/following{/other_user}","gists_url":"https://api.github.com/users/projectcalico/gists{/gist_id}","starred_url":"https://api.github.com/users/projectcalico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectcalico/subscriptions","organizations_url":"https://api.github.com/users/projectcalico/orgs","repos_url":"https://api.github.com/users/projectcalico/repos","events_url":"https://api.github.com/users/projectcalico/events{/privacy}","received_events_url":"https://api.github.com/users/projectcalico/received_events","type":"Organization","site_admin":false},"repo":{"id":39913632,"name":"calico-kubernetes","full_name":"projectcalico/calico-kubernetes","owner":{"login":"projectcalico","id":12304728,"avatar_url":"https://avatars.githubusercontent.com/u/12304728?v=3","gravatar_id":"","url":"https://api.github.com/users/projectcalico","html_url":"https://github.com/projectcalico","followers_url":"https://api.github.com/users/projectcalico/followers","following_url":"https://api.github.com/users/projectcalico/following{/other_user}","gists_url":"https://api.github.com/users/projectcalico/gists{/gist_id}","starred_url":"https://api.github.com/users/projectcalico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectcalico/subscriptions","organizations_url":"https://api.github.com/users/projectcalico/orgs","repos_url":"https://api.github.com/users/projectcalico/repos","events_url":"https://api.github.com/users/projectcalico/events{/privacy}","received_events_url":"https://api.github.com/users/projectcalico/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projectcalico/calico-kubernetes","description":"Calico Kubernetes Networking Plugin","fork":false,"url":"https://api.github.com/repos/projectcalico/calico-kubernetes","forks_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/forks","keys_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/teams","hooks_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/hooks","issue_events_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/events","assignees_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/tags","blobs_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/languages","stargazers_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/stargazers","contributors_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/contributors","subscribers_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/subscribers","subscription_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/subscription","commits_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/merges","archive_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/downloads","issues_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/projectcalico/calico-kubernetes/releases{/id}","created_at":"2015-07-29T20:04:46Z","updated_at":"2015-08-14T21:59:02Z","pushed_at":"2015-08-14T22:12:08Z","git_url":"git://github.com/projectcalico/calico-kubernetes.git","ssh_url":"git@github.com:projectcalico/calico-kubernetes.git","clone_url":"https://github.com/projectcalico/calico-kubernetes.git","svn_url":"https://github.com/projectcalico/calico-kubernetes","homepage":"","size":318,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":7,"forks":3,"open_issues":7,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/6"},"html":{"href":"https://github.com/projectcalico/calico-kubernetes/pull/6"},"issue":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues/6"},"comments":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/projectcalico/calico-kubernetes/statuses/1a284da2fa554e0277b783514b216f0e07bae336"}}}}