From 3b8209c98218abfea0bd5b9f8f9ddf02888bd75a Mon Sep 17 00:00:00 2001
From: Paul Bourke <paul.bourke@oracle.com>
Date: Fri, 16 Sep 2016 16:48:02 +0100
Subject: [PATCH] Fix up aodh config templates

* The recently merged aodh role is trying to copy api_paste.ini on startup
which is already present at build time.

* memcache_servers was using incorrect for loop syntax

Note, the trim_blocks header is to solve the issue highlighted by
Jeffrey[0]

[0] http://lists.openstack.org/pipermail/openstack-dev/2016-September/103532.html

Change-Id: I8baa5446b3b6271d57d54c4c1663a338d8ab3cc8
Closes-Bug: #1624462
---
 ansible/roles/aodh/templates/aodh-api.json.j2 | 6 ------
 ansible/roles/aodh/templates/aodh.conf.j2     | 3 ++-
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/ansible/roles/aodh/templates/aodh-api.json.j2 b/ansible/roles/aodh/templates/aodh-api.json.j2
index 59fdc733c7..ced2d1b6d0 100644
--- a/ansible/roles/aodh/templates/aodh-api.json.j2
+++ b/ansible/roles/aodh/templates/aodh-api.json.j2
@@ -9,12 +9,6 @@
             "owner": "aodh",
             "perm": "0644"
         },
-        {
-            "source": "{{ container_config_directory }}/api_paste.ini",
-            "dest": "/etc/aodh/api_paste.ini",
-            "owner": "aodh",
-            "perm": "0644"
-        },
         {
             "source": "{{ container_config_directory }}/wsgi-aodh.conf",
             "dest": "/etc/{{ aodh_dir }}/wsgi-aodh.conf",
diff --git a/ansible/roles/aodh/templates/aodh.conf.j2 b/ansible/roles/aodh/templates/aodh.conf.j2
index aee2e16952..0295a44afb 100644
--- a/ansible/roles/aodh/templates/aodh.conf.j2
+++ b/ansible/roles/aodh/templates/aodh.conf.j2
@@ -1,3 +1,4 @@
+#jinja2: trim_blocks: False
 [DEFAULT]
 auth_strategy = keystone
 log_dir = /var/log/kolla/aodh
@@ -17,7 +18,7 @@ connection = mysql+pymysql://{{ aodh_database_user }}:{{ aodh_database_password
 [keystone_authtoken]
 memcache_security_strategy = ENCRYPT
 memcache_secret_key = {{ memcache_secret_key }}
-memcache_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address']
+memcache_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %}
 auth_uri = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_public_port }}
 project_domain_name = default
 project_name = service