mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #15068 from OwenTuz/issue-15067
Name the AWS inventory cache based on the profile in use
This commit is contained in:
commit
9005f91bb0
1 changed files with 8 additions and 2 deletions
|
@ -331,8 +331,14 @@ class Ec2Inventory(object):
|
||||||
if not os.path.exists(cache_dir):
|
if not os.path.exists(cache_dir):
|
||||||
os.makedirs(cache_dir)
|
os.makedirs(cache_dir)
|
||||||
|
|
||||||
self.cache_path_cache = cache_dir + "/ansible-ec2.cache"
|
cache_name = 'ansible-ec2'
|
||||||
self.cache_path_index = cache_dir + "/ansible-ec2.index"
|
aws_profile = lambda: (self.boto_profile or
|
||||||
|
os.environ.get('AWS_PROFILE') or
|
||||||
|
os.environ.get('AWS_ACCESS_KEY_ID'))
|
||||||
|
if aws_profile():
|
||||||
|
cache_name = '%s-%s' % (cache_name, aws_profile())
|
||||||
|
self.cache_path_cache = cache_dir + "/%s.cache" % cache_name
|
||||||
|
self.cache_path_index = cache_dir + "/%s.index" % cache_name
|
||||||
self.cache_max_age = config.getint('ec2', 'cache_max_age')
|
self.cache_max_age = config.getint('ec2', 'cache_max_age')
|
||||||
|
|
||||||
if config.has_option('ec2', 'expand_csv_tags'):
|
if config.has_option('ec2', 'expand_csv_tags'):
|
||||||
|
|
Loading…
Reference in a new issue