diff --git a/manifests/profile/base/heat.pp b/manifests/profile/base/heat.pp index 496f4ffbb..55beec099 100644 --- a/manifests/profile/base/heat.pp +++ b/manifests/profile/base/heat.pp @@ -78,7 +78,11 @@ # [*oslomsg_notify_use_ssl*] # Enable ssl oslo messaging services # Defaults to hiera('oslo_messaging_notify_use_ssl', '0') - +# +# [*memcached_ips*] +# (Optional) Array of ipv4 or ipv6 addresses for memcache. +# Defaults to hiera('memcached_node_ips') +# class tripleo::profile::base::heat ( $bootstrap_node = downcase(hiera('heat_engine_short_bootstrap_node_name')), $manage_db_purge = hiera('heat_enable_db_purge', true), @@ -95,6 +99,7 @@ class tripleo::profile::base::heat ( $oslomsg_notify_port = hiera('oslo_messaging_notify_port', '5672'), $oslomsg_notify_username = hiera('oslo_messaging_notify_user_name', 'guest'), $oslomsg_notify_use_ssl = hiera('oslo_messaging_notify_use_ssl', '0'), + $memcached_ips = hiera('memcached_node_ips'), ) { include ::tripleo::profile::base::heat::authtoken @@ -131,7 +136,16 @@ class tripleo::profile::base::heat ( include ::heat::config include ::heat::cors include ::heat::logging - include ::heat::cache + + if is_ipv6_address($memcached_ips[0]) { + $memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:') + } else { + $memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211') + } + + class { '::heat::cache': + memcache_servers => $memcache_servers + } } if $step >= 5 { diff --git a/spec/classes/tripleo_profile_base_heat_spec.rb b/spec/classes/tripleo_profile_base_heat_spec.rb index 9d1643401..82123ba74 100644 --- a/spec/classes/tripleo_profile_base_heat_spec.rb +++ b/spec/classes/tripleo_profile_base_heat_spec.rb @@ -52,7 +52,8 @@ eos :oslomsg_notify_hosts => [ '192.168.0.2' ], :oslomsg_notify_username => 'heat2', :oslomsg_notify_password => 'baa', - :oslomsg_notify_port => '5678' + :oslomsg_notify_port => '5678', + :memcached_ips => '127.0.0.1', } } it 'should trigger complete configuration without db_purge' do @@ -70,7 +71,9 @@ eos is_expected.to contain_class('heat::config') is_expected.to contain_class('heat::cors') is_expected.to contain_class('heat::logging') - is_expected.to contain_class('heat::cache') + is_expected.to contain_class('heat::cache').with( + :memcache_servers => ['127.0.0.1:11211'] + ) is_expected.to_not contain_class('heat::cron::purge_deleted') end end @@ -85,7 +88,8 @@ eos :oslomsg_notify_hosts => [ '192.168.0.2' ], :oslomsg_notify_username => 'heat2', :oslomsg_notify_password => 'baa', - :oslomsg_notify_port => '5678' + :oslomsg_notify_port => '5678', + :memcached_ips => '127.0.0.1', } } it 'should trigger complete configuration' do @@ -104,6 +108,9 @@ eos is_expected.to contain_class('heat::cors') is_expected.to contain_class('heat::logging') is_expected.to contain_class('heat::cache') + is_expected.to contain_class('heat::cache').with( + :memcache_servers => ['127.0.0.1:11211'] + ) is_expected.to contain_class('heat::cron::purge_deleted') end end @@ -120,7 +127,8 @@ eos :oslomsg_notify_username => 'heat2', :oslomsg_notify_password => 'baa', :oslomsg_notify_port => '5678', - :manage_db_purge => false + :manage_db_purge => false, + :memcached_ips => '::1', } } it 'should trigger complete configuration without db_purge' do @@ -138,7 +146,9 @@ eos is_expected.to contain_class('heat::config') is_expected.to contain_class('heat::cors') is_expected.to contain_class('heat::logging') - is_expected.to contain_class('heat::cache') + is_expected.to contain_class('heat::cache').with( + :memcache_servers => ['[::1]:11211'] + ) is_expected.to_not contain_class('heat::cron::purge_deleted') end end