Check heat.cache.members is defined or not

Change-Id: Ieae2960cd431186a3a0f8e03702301f62fe42043
diff --git a/heat/files/mitaka/heat.conf.Debian b/heat/files/mitaka/heat.conf.Debian
index 50efa5d..bfaa6f9 100644
--- a/heat/files/mitaka/heat.conf.Debian
+++ b/heat/files/mitaka/heat.conf.Debian
@@ -437,11 +437,8 @@
 #project_name = {{ server.identity.tenant }}
 #project_domain_name = default
 #user_domain_name = default
-{%- if server.cache is defined %}
-#memcached_servers={%- for member in server.cache.members %}{{ member.host }}:11211{% if not loop.last %},{% endif %}{%- endfor %}
-{%- endif %}
 
-{%- if server.cache is defined %}
+{%- if server.get('cache', {}).members is defined %}
 [cache]
 enabled=True
 backend=oslo_cache.memcache_pool
diff --git a/heat/files/newton/heat.conf.Debian b/heat/files/newton/heat.conf.Debian
index 4e82cc4..02e5870 100644
--- a/heat/files/newton/heat.conf.Debian
+++ b/heat/files/newton/heat.conf.Debian
@@ -449,11 +449,9 @@
 project_name = {{ server.identity.tenant }}
 project_domain_name = Default
 user_domain_name = Default
-{%- if server.cache is defined %}
+{%- if server.get('cache', {}).members is defined %}
 memcached_servers={%- for member in server.cache.members %}{{ member.host }}:11211{% if not loop.last %},{% endif %}{%- endfor %}
-{%- endif %}
 
-{%- if server.cache is defined %}
 [cache]
 enabled=True
 backend=oslo_cache.memcache_pool
diff --git a/heat/files/ocata/heat.conf.Debian b/heat/files/ocata/heat.conf.Debian
index 3978230..f00a537 100644
--- a/heat/files/ocata/heat.conf.Debian
+++ b/heat/files/ocata/heat.conf.Debian
@@ -1769,11 +1769,9 @@
 project_name = {{ server.identity.tenant }}
 project_domain_name = Default
 user_domain_name = Default
-{%- if server.cache is defined %}
+{%- if server.get('cache', {}).members is defined %}
 memcached_servers={%- for member in server.cache.members %}{{ member.host }}:11211{% if not loop.last %},{% endif %}{%- endfor %}
-{%- endif %}
 
-{%- if server.cache is defined %}
 [cache]
 enabled=True
 backend=oslo_cache.memcache_pool
diff --git a/heat/files/pike/heat.conf.Debian b/heat/files/pike/heat.conf.Debian
index 293d0bc..0c970b1 100644
--- a/heat/files/pike/heat.conf.Debian
+++ b/heat/files/pike/heat.conf.Debian
@@ -1777,7 +1777,7 @@
 project_name = {{ server.identity.tenant }}
 project_domain_name = Default
 user_domain_name = Default
-{%- if server.cache is defined %}
+{%- if server.get('cache', {}).members is defined %}
 memcached_servers={%- for member in server.cache.members %}{{ member.host }}:11211{% if not loop.last %},{% endif %}{%- endfor %}
   {%- if server.cache.get('security', {}).get('enabled', False) %}
 memcache_security_strategy = {{ server.cache.security.get('strategy', 'ENCRYPT') }}
@@ -1787,9 +1787,7 @@
 memcache_secret_key = {{ server.cache.security.secret_key }}
     {%- endif %}
   {%- endif %}
-{%- endif %}
 
-{%- if server.cache is defined %}
 [cache]
 enabled=True
 backend=oslo_cache.memcache_pool