Skip to content

Commit

Permalink
Add zone to instance-retrieval-from-group
Browse files Browse the repository at this point in the history
  • Loading branch information
sgammon committed Feb 10, 2017
1 parent 991f125 commit e02ff9f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fabric_gce_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def _build_instances_index(data):
instanceData = instance
elif instance.get("instance") != None:
## need to retrieve the instance itself, we're coming from an instance group
raw_instance_data = subprocess.check_output("gcloud compute instances describe %s --format=json" % instance["instance"].split("/")[-1], shell=True)
raw_instance_data = subprocess.check_output("gcloud compute instances describe %s --zone=%s --format=json" %
(instance["instance"].split("/")[-1],
instance["instance"].split("/")[-3]), shell=True)
instanceData = json.loads(raw_instance_data)

ip = instanceData.get("networkInterfaces", [{}])[0].get("accessConfigs", [{}])[0].get("natIP", None)
Expand Down

0 comments on commit e02ff9f

Please sign in to comment.