Commit 4cb25800 by Joe Blaylock

Merge pull request #324 from edx/sef/add-inifile-to-ec2.py-again

re-apply ec2.py fixes for inifile
parents adce29d5 858b0b6f
...@@ -137,8 +137,8 @@ class Ec2Inventory(object): ...@@ -137,8 +137,8 @@ class Ec2Inventory(object):
self.index = {} self.index = {}
# Read settings and parse CLI arguments # Read settings and parse CLI arguments
self.read_settings()
self.parse_cli_args() self.parse_cli_args()
self.read_settings()
# Cache # Cache
if self.args.refresh_cache: if self.args.refresh_cache:
...@@ -177,7 +177,7 @@ class Ec2Inventory(object): ...@@ -177,7 +177,7 @@ class Ec2Inventory(object):
''' Reads the settings from the ec2.ini file ''' ''' Reads the settings from the ec2.ini file '''
config = ConfigParser.SafeConfigParser() config = ConfigParser.SafeConfigParser()
config.read(os.path.dirname(os.path.realpath(__file__)) + '/ec2.ini') config.read(self.args.inifile)
# is eucalyptus? # is eucalyptus?
self.eucalyptus_host = None self.eucalyptus_host = None
...@@ -230,6 +230,10 @@ class Ec2Inventory(object): ...@@ -230,6 +230,10 @@ class Ec2Inventory(object):
help='Get all the variables about a specific instance') help='Get all the variables about a specific instance')
parser.add_argument('--refresh-cache', action='store_true', default=False, parser.add_argument('--refresh-cache', action='store_true', default=False,
help='Force refresh of cache by making API requests to EC2 (default: False - use cache files)') help='Force refresh of cache by making API requests to EC2 (default: False - use cache files)')
default_inifile = os.environ.get("ANSIBLE_EC2_INI", os.path.dirname(os.path.realpath(__file__))+'/ec2.ini')
parser.add_argument('--inifile', dest='inifile', help='Path to init script to use', default=default_inifile)
self.args = parser.parse_args() self.args = parser.parse_args()
......
[ec2] [ec2]
regions=us-west-1 regions=us-west-1
regions_exclude = us-gov-west-1
destination_variable=public_dns_name destination_variable=public_dns_name
vpc_destination_variable=private_dns_name vpc_destination_variable=private_dns_name
cache_path=/tmp cache_path=/tmp
cache_max_age=300 cache_max_age=300
route53=False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment