Merge "Set memcache_servers for heat::cache automatically" into stable/train

This commit is contained in:
Zuul 2021-04-08 17:55:29 +00:00 committed by Gerrit Code Review
commit d1f6757ce3
2 changed files with 31 additions and 7 deletions

View File

@ -78,7 +78,11 @@
# [*oslomsg_notify_use_ssl*] # [*oslomsg_notify_use_ssl*]
# Enable ssl oslo messaging services # Enable ssl oslo messaging services
# Defaults to hiera('oslo_messaging_notify_use_ssl', '0') # 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 ( class tripleo::profile::base::heat (
$bootstrap_node = downcase(hiera('heat_engine_short_bootstrap_node_name')), $bootstrap_node = downcase(hiera('heat_engine_short_bootstrap_node_name')),
$manage_db_purge = hiera('heat_enable_db_purge', true), $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_port = hiera('oslo_messaging_notify_port', '5672'),
$oslomsg_notify_username = hiera('oslo_messaging_notify_user_name', 'guest'), $oslomsg_notify_username = hiera('oslo_messaging_notify_user_name', 'guest'),
$oslomsg_notify_use_ssl = hiera('oslo_messaging_notify_use_ssl', '0'), $oslomsg_notify_use_ssl = hiera('oslo_messaging_notify_use_ssl', '0'),
$memcached_ips = hiera('memcached_node_ips'),
) { ) {
include ::tripleo::profile::base::heat::authtoken include ::tripleo::profile::base::heat::authtoken
@ -131,7 +136,16 @@ class tripleo::profile::base::heat (
include ::heat::config include ::heat::config
include ::heat::cors include ::heat::cors
include ::heat::logging 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 { if $step >= 5 {

View File

@ -52,7 +52,8 @@ eos
:oslomsg_notify_hosts => [ '192.168.0.2' ], :oslomsg_notify_hosts => [ '192.168.0.2' ],
:oslomsg_notify_username => 'heat2', :oslomsg_notify_username => 'heat2',
:oslomsg_notify_password => 'baa', :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 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::config')
is_expected.to contain_class('heat::cors') is_expected.to contain_class('heat::cors')
is_expected.to contain_class('heat::logging') 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') is_expected.to_not contain_class('heat::cron::purge_deleted')
end end
end end
@ -85,7 +88,8 @@ eos
:oslomsg_notify_hosts => [ '192.168.0.2' ], :oslomsg_notify_hosts => [ '192.168.0.2' ],
:oslomsg_notify_username => 'heat2', :oslomsg_notify_username => 'heat2',
:oslomsg_notify_password => 'baa', :oslomsg_notify_password => 'baa',
:oslomsg_notify_port => '5678' :oslomsg_notify_port => '5678',
:memcached_ips => '127.0.0.1',
} } } }
it 'should trigger complete configuration' do it 'should trigger complete configuration' do
@ -104,6 +108,9 @@ eos
is_expected.to contain_class('heat::cors') is_expected.to contain_class('heat::cors')
is_expected.to contain_class('heat::logging') is_expected.to contain_class('heat::logging')
is_expected.to contain_class('heat::cache') 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') is_expected.to contain_class('heat::cron::purge_deleted')
end end
end end
@ -120,7 +127,8 @@ eos
:oslomsg_notify_username => 'heat2', :oslomsg_notify_username => 'heat2',
:oslomsg_notify_password => 'baa', :oslomsg_notify_password => 'baa',
:oslomsg_notify_port => '5678', :oslomsg_notify_port => '5678',
:manage_db_purge => false :manage_db_purge => false,
:memcached_ips => '::1',
} } } }
it 'should trigger complete configuration without db_purge' do 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::config')
is_expected.to contain_class('heat::cors') is_expected.to contain_class('heat::cors')
is_expected.to contain_class('heat::logging') 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') is_expected.to_not contain_class('heat::cron::purge_deleted')
end end
end end