2016-12-12 14 views
1

За последние несколько дней я получаю следующую ошибку при запуске загружаемых загрузочных книг с использованием облачных модулей AWS или при непосредственном запуске файла ec2.py с ключом -refresh-cache команда из моей локальной машины:Ошибка обновления ElastiCache в Ec2.py при запуске Ansible playbooks

ap:~ ap$ /ansible/inventory/ec2.py --refresh-cache 
Traceback (most recent call last): 
    File "/ansible/inventory/ec2.py", line 1510, in <module> 
    Ec2Inventory() 
    File "/ansible/inventory/ec2.py", line 186, in __init__ 
    self.do_api_calls_update_cache() 
    File "/ansible/inventory/ec2.py", line 492, in do_api_calls_update_cache 
    self.get_elasticache_replication_groups_by_region(region) 
    File "/ansible/inventory/ec2.py", line 722, in get_elasticache_replication_groups_by_region 
    self.add_elasticache_replication_group(replication_group, region) 
    File "/ansible/inventory/ec2.py", line 1198, in add_elasticache_replication_group 
    dest = replication_group['NodeGroups'][0]['PrimaryEndpoint']['Address'] 
TypeError: 'NoneType' object has no attribute '__getitem__' 

Этого вопрос, кажется, уходит, когда работает от экземпляра EC2 в счете AWS.

У меня есть последние файлы EC2.py и EC2.ini, Ansible version is 2.2.0.0, boto3 установлен, и я устанавливаю действительные учетные данные AWS перед запуском playbook.

Любые идеи о том, что происходит?

ответ

1

Попробуйте патч на https://github.com/ansible/ansible/pull/20190


@@ -1194,13 +1194,14 @@ def add_elasticache_replication_group(self, replication_group, region): 
      if not self.all_elasticache_replication_groups and replication_group['Status'] != 'available': 
       return 

+  # Skip clusters we cannot address (e.g. private VPC subnet or clustered redis) 
+  if replication_group['NodeGroups'][0]['PrimaryEndpoint'] is None or \ 
+   replication_group['NodeGroups'][0]['PrimaryEndpoint']['Address'] is None: 
+   return 
+ 
      # Select the best destination address (PrimaryEndpoint) 
      dest = replication_group['NodeGroups'][0]['PrimaryEndpoint']['Address'] 

-  if not dest: 
-   # Skip clusters we cannot address (e.g. private VPC subnet) 
-   return 
- 
      # Add to index 
      self.index[dest] = [region, replication_group['ReplicationGroupId']] 
+0

Корабль это пожалуйста :-) – Metallikanz