Skip to content

Commit

Permalink
integ tests: fetch public ip from ec2 if not in cfn outputs
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco De Martino <fdm@amazon.com>
  • Loading branch information
demartinofra committed Jun 12, 2019
1 parent e03906b commit 28ecf9d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/integration-tests/clusters_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import logging
import time

import boto3
import configparser
from retrying import retry

Expand Down Expand Up @@ -68,7 +69,13 @@ def region(self):
@property
def master_ip(self):
"""Return the public ip of the cluster master node."""
return self.cfn_outputs["MasterPublicIP"]
if "MasterPublicIP" in self.cfn_outputs:
return self.cfn_outputs["MasterPublicIP"]
else:
ec2 = boto3.client("ec2", region_name=self.region)
master_server = self.cfn_resources["MasterServer"]
instance = ec2.describe_instances(InstanceIds=[master_server]).get("Reservations")[0].get("Instances")[0]
return instance.get("PublicIpAddress")

@property
def os(self):
Expand Down

0 comments on commit 28ecf9d

Please sign in to comment.