{"action":"created","comment":{"url":"https://api.github.com/repos/confluentinc/ducktape/pulls/comments/49401915","id":49401915,"diff_hunk":"@@ -22,12 +26,49 @@ class VagrantCluster(JsonCluster):\n     \"\"\"\n     An implementation of Cluster that uses a set of VMs created by Vagrant. Because we need hostnames that can be\n     advertised, this assumes that the Vagrant VM's name is a routeable hostname on all the hosts.\n+\n+    - If cluster_file is specified in the constructor's kwargs (i.e. passed via command line argument --cluster-file)\n+      - If cluster_file exists on the filesystem, read cluster info from the file\n+      - Otherwise, retrieve cluster info via \"vagrant ssh-config\" from vagrant and write cluster info to cluster_file\n+    - Otherwise, retrieve cluster info via \"vagrant ssh-config\" from vagrant\n     \"\"\"\n \n-    def __init__(self):\n-        hostname, ssh_hostname, username, flags = None, None, None, \"\"\n-        nodes = []\n+    def __init__(self, *args, **kwargs):\n+        is_read_from_file = False\n+\n+        cluster_file = kwargs.get(\"cluster_file\")\n+        if cluster_file is not None:\n+            try:\n+                cluster_json = json.load(open(os.path.abspath(cluster_file)))\n+                is_read_from_file = True\n+            except IOError:\n+                # It is OK if file is not found. Call vagrant ssh-info to read the cluster info.\n+                pass\n+\n+        if not is_read_from_file:\n+            cluster_json = {\n+                \"nodes\": self._get_nodes_from_vagrant()\n+            }\n+\n+        super(VagrantCluster, self).__init__(cluster_json)\n+\n+        is_aws = self._is_aws()\n+        if not is_read_from_file:\n+            # go through and find fully qualified domain name for each node\n+            # this makes it possible to not require write access to /etc/hosts on the test driver machine\n+            externally_routable_ip = {}\n+            for node_account in self.available_nodes:\n+                node_account.externally_routable_ip = self._externally_routable_ip(is_aws, node_account)\n+                externally_routable_ip[str(node_account)] = node_account.externally_routable_ip\n \n+            # If cluster_file is specified, cache cluster info in the file\n+            if cluster_file is not None:\n+                cluster_json[\"externally_routable_ip\"] = externally_routable_ip","path":"ducktape/cluster/vagrant.py","position":60,"original_position":60,"commit_id":"905dd31c329dd682fa67dba3ec60b8bab214b71a","original_commit_id":"905dd31c329dd682fa67dba3ec60b8bab214b71a","user":{"login":"granders","id":1295932,"avatar_url":"https://avatars.githubusercontent.com/u/1295932?v=3","gravatar_id":"","url":"https://api.github.com/users/granders","html_url":"https://github.com/granders","followers_url":"https://api.github.com/users/granders/followers","following_url":"https://api.github.com/users/granders/following{/other_user}","gists_url":"https://api.github.com/users/granders/gists{/gist_id}","starred_url":"https://api.github.com/users/granders/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/granders/subscriptions","organizations_url":"https://api.github.com/users/granders/orgs","repos_url":"https://api.github.com/users/granders/repos","events_url":"https://api.github.com/users/granders/events{/privacy}","received_events_url":"https://api.github.com/users/granders/received_events","type":"User","site_admin":false},"body":"Yep that's right we want this info but in slightly different format (hopefully my next comment will clarify this)","created_at":"2016-01-12T00:45:14Z","updated_at":"2016-01-12T00:45:14Z","html_url":"https://github.com/confluentinc/ducktape/pull/126#discussion_r49401915","pull_request_url":"https://api.github.com/repos/confluentinc/ducktape/pulls/126","_links":{"self":{"href":"https://api.github.com/repos/confluentinc/ducktape/pulls/comments/49401915"},"html":{"href":"https://github.com/confluentinc/ducktape/pull/126#discussion_r49401915"},"pull_request":{"href":"https://api.github.com/repos/confluentinc/ducktape/pulls/126"}}},"pull_request":{"url":"https://api.github.com/repos/confluentinc/ducktape/pulls/126","id":50173958,"html_url":"https://github.com/confluentinc/ducktape/pull/126","diff_url":"https://github.com/confluentinc/ducktape/pull/126.diff","patch_url":"https://github.com/confluentinc/ducktape/pull/126.patch","issue_url":"https://api.github.com/repos/confluentinc/ducktape/issues/126","number":126,"state":"open","locked":false,"title":"issue-114; Cache Vagrant ssh info","user":{"login":"lindong28","id":5873403,"avatar_url":"https://avatars.githubusercontent.com/u/5873403?v=3","gravatar_id":"","url":"https://api.github.com/users/lindong28","html_url":"https://github.com/lindong28","followers_url":"https://api.github.com/users/lindong28/followers","following_url":"https://api.github.com/users/lindong28/following{/other_user}","gists_url":"https://api.github.com/users/lindong28/gists{/gist_id}","starred_url":"https://api.github.com/users/lindong28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lindong28/subscriptions","organizations_url":"https://api.github.com/users/lindong28/orgs","repos_url":"https://api.github.com/users/lindong28/repos","events_url":"https://api.github.com/users/lindong28/events{/privacy}","received_events_url":"https://api.github.com/users/lindong28/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-09T20:36:54Z","updated_at":"2016-01-12T00:45:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2f5fa5c9cc0cb6aaed75fdffebc57a10de02ccc7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/confluentinc/ducktape/pulls/126/commits","review_comments_url":"https://api.github.com/repos/confluentinc/ducktape/pulls/126/comments","review_comment_url":"https://api.github.com/repos/confluentinc/ducktape/pulls/comments{/number}","comments_url":"https://api.github.com/repos/confluentinc/ducktape/issues/126/comments","statuses_url":"https://api.github.com/repos/confluentinc/ducktape/statuses/905dd31c329dd682fa67dba3ec60b8bab214b71a","head":{"label":"lindong28:issue-114","ref":"issue-114","sha":"905dd31c329dd682fa67dba3ec60b8bab214b71a","user":{"login":"lindong28","id":5873403,"avatar_url":"https://avatars.githubusercontent.com/u/5873403?v=3","gravatar_id":"","url":"https://api.github.com/users/lindong28","html_url":"https://github.com/lindong28","followers_url":"https://api.github.com/users/lindong28/followers","following_url":"https://api.github.com/users/lindong28/following{/other_user}","gists_url":"https://api.github.com/users/lindong28/gists{/gist_id}","starred_url":"https://api.github.com/users/lindong28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lindong28/subscriptions","organizations_url":"https://api.github.com/users/lindong28/orgs","repos_url":"https://api.github.com/users/lindong28/repos","events_url":"https://api.github.com/users/lindong28/events{/privacy}","received_events_url":"https://api.github.com/users/lindong28/received_events","type":"User","site_admin":false},"repo":{"id":40281366,"name":"ducktape","full_name":"lindong28/ducktape","owner":{"login":"lindong28","id":5873403,"avatar_url":"https://avatars.githubusercontent.com/u/5873403?v=3","gravatar_id":"","url":"https://api.github.com/users/lindong28","html_url":"https://github.com/lindong28","followers_url":"https://api.github.com/users/lindong28/followers","following_url":"https://api.github.com/users/lindong28/following{/other_user}","gists_url":"https://api.github.com/users/lindong28/gists{/gist_id}","starred_url":"https://api.github.com/users/lindong28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lindong28/subscriptions","organizations_url":"https://api.github.com/users/lindong28/orgs","repos_url":"https://api.github.com/users/lindong28/repos","events_url":"https://api.github.com/users/lindong28/events{/privacy}","received_events_url":"https://api.github.com/users/lindong28/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lindong28/ducktape","description":"System integration and performance tests","fork":true,"url":"https://api.github.com/repos/lindong28/ducktape","forks_url":"https://api.github.com/repos/lindong28/ducktape/forks","keys_url":"https://api.github.com/repos/lindong28/ducktape/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lindong28/ducktape/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lindong28/ducktape/teams","hooks_url":"https://api.github.com/repos/lindong28/ducktape/hooks","issue_events_url":"https://api.github.com/repos/lindong28/ducktape/issues/events{/number}","events_url":"https://api.github.com/repos/lindong28/ducktape/events","assignees_url":"https://api.github.com/repos/lindong28/ducktape/assignees{/user}","branches_url":"https://api.github.com/repos/lindong28/ducktape/branches{/branch}","tags_url":"https://api.github.com/repos/lindong28/ducktape/tags","blobs_url":"https://api.github.com/repos/lindong28/ducktape/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lindong28/ducktape/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lindong28/ducktape/git/refs{/sha}","trees_url":"https://api.github.com/repos/lindong28/ducktape/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lindong28/ducktape/statuses/{sha}","languages_url":"https://api.github.com/repos/lindong28/ducktape/languages","stargazers_url":"https://api.github.com/repos/lindong28/ducktape/stargazers","contributors_url":"https://api.github.com/repos/lindong28/ducktape/contributors","subscribers_url":"https://api.github.com/repos/lindong28/ducktape/subscribers","subscription_url":"https://api.github.com/repos/lindong28/ducktape/subscription","commits_url":"https://api.github.com/repos/lindong28/ducktape/commits{/sha}","git_commits_url":"https://api.github.com/repos/lindong28/ducktape/git/commits{/sha}","comments_url":"https://api.github.com/repos/lindong28/ducktape/comments{/number}","issue_comment_url":"https://api.github.com/repos/lindong28/ducktape/issues/comments{/number}","contents_url":"https://api.github.com/repos/lindong28/ducktape/contents/{+path}","compare_url":"https://api.github.com/repos/lindong28/ducktape/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lindong28/ducktape/merges","archive_url":"https://api.github.com/repos/lindong28/ducktape/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lindong28/ducktape/downloads","issues_url":"https://api.github.com/repos/lindong28/ducktape/issues{/number}","pulls_url":"https://api.github.com/repos/lindong28/ducktape/pulls{/number}","milestones_url":"https://api.github.com/repos/lindong28/ducktape/milestones{/number}","notifications_url":"https://api.github.com/repos/lindong28/ducktape/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lindong28/ducktape/labels{/name}","releases_url":"https://api.github.com/repos/lindong28/ducktape/releases{/id}","created_at":"2015-08-06T03:05:00Z","updated_at":"2015-08-06T03:05:00Z","pushed_at":"2016-01-11T19:39:33Z","git_url":"git://github.com/lindong28/ducktape.git","ssh_url":"git@github.com:lindong28/ducktape.git","clone_url":"https://github.com/lindong28/ducktape.git","svn_url":"https://github.com/lindong28/ducktape","homepage":null,"size":466,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"confluentinc:master","ref":"master","sha":"31e04c37f4ee44a70507df48900c37e7c3d07452","user":{"login":"confluentinc","id":9439498,"avatar_url":"https://avatars.githubusercontent.com/u/9439498?v=3","gravatar_id":"","url":"https://api.github.com/users/confluentinc","html_url":"https://github.com/confluentinc","followers_url":"https://api.github.com/users/confluentinc/followers","following_url":"https://api.github.com/users/confluentinc/following{/other_user}","gists_url":"https://api.github.com/users/confluentinc/gists{/gist_id}","starred_url":"https://api.github.com/users/confluentinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confluentinc/subscriptions","organizations_url":"https://api.github.com/users/confluentinc/orgs","repos_url":"https://api.github.com/users/confluentinc/repos","events_url":"https://api.github.com/users/confluentinc/events{/privacy}","received_events_url":"https://api.github.com/users/confluentinc/received_events","type":"Organization","site_admin":false},"repo":{"id":28360638,"name":"ducktape","full_name":"confluentinc/ducktape","owner":{"login":"confluentinc","id":9439498,"avatar_url":"https://avatars.githubusercontent.com/u/9439498?v=3","gravatar_id":"","url":"https://api.github.com/users/confluentinc","html_url":"https://github.com/confluentinc","followers_url":"https://api.github.com/users/confluentinc/followers","following_url":"https://api.github.com/users/confluentinc/following{/other_user}","gists_url":"https://api.github.com/users/confluentinc/gists{/gist_id}","starred_url":"https://api.github.com/users/confluentinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confluentinc/subscriptions","organizations_url":"https://api.github.com/users/confluentinc/orgs","repos_url":"https://api.github.com/users/confluentinc/repos","events_url":"https://api.github.com/users/confluentinc/events{/privacy}","received_events_url":"https://api.github.com/users/confluentinc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/confluentinc/ducktape","description":"System integration and performance tests","fork":false,"url":"https://api.github.com/repos/confluentinc/ducktape","forks_url":"https://api.github.com/repos/confluentinc/ducktape/forks","keys_url":"https://api.github.com/repos/confluentinc/ducktape/keys{/key_id}","collaborators_url":"https://api.github.com/repos/confluentinc/ducktape/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/confluentinc/ducktape/teams","hooks_url":"https://api.github.com/repos/confluentinc/ducktape/hooks","issue_events_url":"https://api.github.com/repos/confluentinc/ducktape/issues/events{/number}","events_url":"https://api.github.com/repos/confluentinc/ducktape/events","assignees_url":"https://api.github.com/repos/confluentinc/ducktape/assignees{/user}","branches_url":"https://api.github.com/repos/confluentinc/ducktape/branches{/branch}","tags_url":"https://api.github.com/repos/confluentinc/ducktape/tags","blobs_url":"https://api.github.com/repos/confluentinc/ducktape/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/confluentinc/ducktape/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/confluentinc/ducktape/git/refs{/sha}","trees_url":"https://api.github.com/repos/confluentinc/ducktape/git/trees{/sha}","statuses_url":"https://api.github.com/repos/confluentinc/ducktape/statuses/{sha}","languages_url":"https://api.github.com/repos/confluentinc/ducktape/languages","stargazers_url":"https://api.github.com/repos/confluentinc/ducktape/stargazers","contributors_url":"https://api.github.com/repos/confluentinc/ducktape/contributors","subscribers_url":"https://api.github.com/repos/confluentinc/ducktape/subscribers","subscription_url":"https://api.github.com/repos/confluentinc/ducktape/subscription","commits_url":"https://api.github.com/repos/confluentinc/ducktape/commits{/sha}","git_commits_url":"https://api.github.com/repos/confluentinc/ducktape/git/commits{/sha}","comments_url":"https://api.github.com/repos/confluentinc/ducktape/comments{/number}","issue_comment_url":"https://api.github.com/repos/confluentinc/ducktape/issues/comments{/number}","contents_url":"https://api.github.com/repos/confluentinc/ducktape/contents/{+path}","compare_url":"https://api.github.com/repos/confluentinc/ducktape/compare/{base}...{head}","merges_url":"https://api.github.com/repos/confluentinc/ducktape/merges","archive_url":"https://api.github.com/repos/confluentinc/ducktape/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/confluentinc/ducktape/downloads","issues_url":"https://api.github.com/repos/confluentinc/ducktape/issues{/number}","pulls_url":"https://api.github.com/repos/confluentinc/ducktape/pulls{/number}","milestones_url":"https://api.github.com/repos/confluentinc/ducktape/milestones{/number}","notifications_url":"https://api.github.com/repos/confluentinc/ducktape/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/confluentinc/ducktape/labels{/name}","releases_url":"https://api.github.com/repos/confluentinc/ducktape/releases{/id}","created_at":"2014-12-22T21:38:32Z","updated_at":"2015-11-11T08:13:55Z","pushed_at":"2016-01-11T19:39:34Z","git_url":"git://github.com/confluentinc/ducktape.git","ssh_url":"git@github.com:confluentinc/ducktape.git","clone_url":"https://github.com/confluentinc/ducktape.git","svn_url":"https://github.com/confluentinc/ducktape","homepage":null,"size":1426,"stargazers_count":20,"watchers_count":20,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":34,"forks":5,"open_issues":34,"watchers":20,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/confluentinc/ducktape/pulls/126"},"html":{"href":"https://github.com/confluentinc/ducktape/pull/126"},"issue":{"href":"https://api.github.com/repos/confluentinc/ducktape/issues/126"},"comments":{"href":"https://api.github.com/repos/confluentinc/ducktape/issues/126/comments"},"review_comments":{"href":"https://api.github.com/repos/confluentinc/ducktape/pulls/126/comments"},"review_comment":{"href":"https://api.github.com/repos/confluentinc/ducktape/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/confluentinc/ducktape/pulls/126/commits"},"statuses":{"href":"https://api.github.com/repos/confluentinc/ducktape/statuses/905dd31c329dd682fa67dba3ec60b8bab214b71a"}}}}