diff --git a/Puppetfile b/Puppetfile index bbda48a2c..8c590559d 100644 --- a/Puppetfile +++ b/Puppetfile @@ -35,7 +35,7 @@ mod 'galera', :git => 'https://github.com/redhat-openstack/puppet-galera.git' mod 'glance', - :commit => '101ca5b088f3aec5d70c567f29dfdfa5609524ab', + :commit => '9c1b0a90d93913548dbada13076cac1470cc5993', :git => 'https://github.com/stackforge/puppet-glance.git' mod 'gluster', diff --git a/glance/.fixtures.yml b/glance/.fixtures.yml index a1e7b2b1d..187635d0e 100644 --- a/glance/.fixtures.yml +++ b/glance/.fixtures.yml @@ -1,7 +1,9 @@ fixtures: repositories: 'apt': 'git://github.com/puppetlabs/puppetlabs-apt.git' - 'concat': 'git://github.com/puppetlabs/puppetlabs-concat.git' + 'concat': + 'repo': 'git://github.com/puppetlabs/puppetlabs-concat.git' + 'ref': '1.2.1' 'keystone': 'git://github.com/stackforge/puppet-keystone.git' 'mysql': 'git://github.com/puppetlabs/puppetlabs-mysql.git' 'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git' diff --git a/glance/manifests/api.pp b/glance/manifests/api.pp index dc8619327..bb58e9100 100644 --- a/glance/manifests/api.pp +++ b/glance/manifests/api.pp @@ -7,6 +7,9 @@ # [*keystone_password*] # (required) Password used to authentication. # +# [*package_ensure*] +# (optional) Ensure state for package. Defaults to 'present'. +# # [*verbose*] # (optional) Rather to log the glance api service at verbose level. # Default: false @@ -184,6 +187,7 @@ # class glance::api( $keystone_password, + $package_ensure = 'present', $verbose = false, $debug = false, $bind_host = '0.0.0.0', @@ -233,13 +237,12 @@ warning('The mysql_module parameter is deprecated. The latest 2.x mysql module will be used.') } - if ( $glance::params::api_package_name != $glance::params::registry_package_name ) { - ensure_packages([$glance::params::api_package_name], - { - tag => ['openstack'], - } - ) - } + ensure_packages([$glance::params::api_package_name], + { + ensure => $package_ensure, + tag => ['openstack'], + } + ) Package[$glance::params::api_package_name] -> File['/etc/glance/'] Package[$glance::params::api_package_name] -> Class['glance::policy'] @@ -292,7 +295,7 @@ 'DEFAULT/workers': value => $workers; 'DEFAULT/show_image_direct_url': value => $show_image_direct_url; 'DEFAULT/image_cache_dir': value => $image_cache_dir; - 'DEFAULT/os_region_name': value => $os_region_name; + 'glance_store/os_region_name': value => $os_region_name; } # known_stores config @@ -307,9 +310,9 @@ } glance_cache_config { - 'DEFAULT/verbose': value => $verbose; - 'DEFAULT/debug': value => $debug; - 'DEFAULT/os_region_name': value => $os_region_name; + 'DEFAULT/verbose': value => $verbose; + 'DEFAULT/debug': value => $debug; + 'glance_store/os_region_name': value => $os_region_name; } # configure api service to connect registry service diff --git a/glance/manifests/init.pp b/glance/manifests/init.pp index 5920ee8d5..5dec9033b 100644 --- a/glance/manifests/init.pp +++ b/glance/manifests/init.pp @@ -2,15 +2,7 @@ # == class: glance # # base glance config. # -# === parameters: -# -# [*package_ensure*] -# (Optional) ensure state for package. -# Defaults to 'present' -# -class glance( - $package_ensure = 'present' -) { +class glance { include ::glance::params @@ -20,12 +12,4 @@ # == class: glance group => 'root', mode => '0770', } - - if ( $glance::params::api_package_name == $glance::params::registry_package_name ) { - package { $glance::params::api_package_name : - ensure => $package_ensure, - name => $::glance::params::package_name, - tag => ['openstack'], - } - } } diff --git a/glance/manifests/notify/rabbitmq.pp b/glance/manifests/notify/rabbitmq.pp index a4b2c4a81..a55434926 100644 --- a/glance/manifests/notify/rabbitmq.pp +++ b/glance/manifests/notify/rabbitmq.pp @@ -87,55 +87,55 @@ if $rabbit_hosts { glance_api_config { - 'DEFAULT/rabbit_hosts': value => join($rabbit_hosts, ','); - 'DEFAULT/rabbit_ha_queues': value => true + 'oslo_messaging_rabbit/rabbit_hosts': value => join($rabbit_hosts, ','); + 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } } else { glance_api_config { - 'DEFAULT/rabbit_host': value => $rabbit_host; - 'DEFAULT/rabbit_port': value => $rabbit_port; - 'DEFAULT/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}"; - 'DEFAULT/rabbit_ha_queues': value => false + 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host; + 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port; + 'oslo_messaging_rabbit/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}"; + 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } } glance_api_config { 'DEFAULT/notification_driver': value => $notification_driver; - 'DEFAULT/rabbit_virtual_host': value => $rabbit_virtual_host; - 'DEFAULT/rabbit_password': value => $rabbit_password, secret => true; - 'DEFAULT/rabbit_userid': value => $rabbit_userid; - 'DEFAULT/rabbit_notification_exchange': value => $rabbit_notification_exchange; - 'DEFAULT/rabbit_notification_topic': value => $rabbit_notification_topic; - 'DEFAULT/rabbit_use_ssl': value => $rabbit_use_ssl; + 'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host; + 'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true; + 'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid; + 'oslo_messaging_rabbit/rabbit_notification_exchange': value => $rabbit_notification_exchange; + 'oslo_messaging_rabbit/rabbit_notification_topic': value => $rabbit_notification_topic; + 'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; 'DEFAULT/amqp_durable_queues': value => $amqp_durable_queues_real; } if $rabbit_use_ssl { - glance_api_config { 'DEFAULT/kombu_ssl_version': value => $kombu_ssl_version } + glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version } if $kombu_ssl_ca_certs { - glance_api_config { 'DEFAULT/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs } + glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs } } else { - glance_api_config { 'DEFAULT/kombu_ssl_ca_certs': ensure => absent} + glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent} } if $kombu_ssl_certfile { - glance_api_config { 'DEFAULT/kombu_ssl_certfile': value => $kombu_ssl_certfile } + glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile } } else { - glance_api_config { 'DEFAULT/kombu_ssl_certfile': ensure => absent} + glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent} } if $kombu_ssl_keyfile { - glance_api_config { 'DEFAULT/kombu_ssl_keyfile': value => $kombu_ssl_keyfile } + glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile } } else { - glance_api_config { 'DEFAULT/kombu_ssl_keyfile': ensure => absent} + glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent} } } else { glance_api_config { - 'DEFAULT/kombu_ssl_version': ensure => absent; - 'DEFAULT/kombu_ssl_ca_certs': ensure => absent; - 'DEFAULT/kombu_ssl_certfile': ensure => absent; - 'DEFAULT/kombu_ssl_keyfile': ensure => absent; + 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent; + 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent; + 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent; + 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent; } if ($kombu_ssl_keyfile or $kombu_ssl_certfile or $kombu_ssl_ca_certs) { notice('Configuration of certificates with $rabbit_use_ssl == false is a useless config') diff --git a/glance/manifests/params.pp b/glance/manifests/params.pp index 61df5b8db..8be763a13 100644 --- a/glance/manifests/params.pp +++ b/glance/manifests/params.pp @@ -10,8 +10,8 @@ case $::osfamily { 'RedHat': { - $api_package_name = 'openstack-glance' - $registry_package_name = 'openstack-glance' + $api_package_name = 'openstack-glance-api' + $registry_package_name = 'openstack-glance-registry' $api_service_name = 'openstack-glance-api' $registry_service_name = 'openstack-glance-registry' $db_sync_command = 'glance-manage --config-file=/etc/glance/glance-registry.conf db_sync' diff --git a/glance/manifests/registry.pp b/glance/manifests/registry.pp index a93db1e25..e11a9b086 100644 --- a/glance/manifests/registry.pp +++ b/glance/manifests/registry.pp @@ -8,9 +8,7 @@ # (required) The keystone password for administrative user # # [*package_ensure*] -# (optional) Ensure state for package. Defaults to 'present'. On RedHat -# platforms this setting is ignored and the setting from the glance class is -# used because there is only one glance package. +# (optional) Ensure state for package. Defaults to 'present'. # # [*verbose*] # (optional) Enable verbose logs (true|false). Defaults to false. @@ -115,6 +113,10 @@ # (optional) CA certificate file to use to verify connecting clients # Defaults to false, not set # +# [*sync_db*] +# (Optional) Run db sync on the node. +# Defaults to true +# # [*mysql_module*] # (optional) Deprecated. Does nothing. # @@ -143,6 +145,7 @@ $cert_file = false, $key_file = false, $ca_file = false, + $sync_db = true, # DEPRECATED PARAMETERS $mysql_module = undef, $auth_host = '127.0.0.1', @@ -157,14 +160,12 @@ warning('The mysql_module parameter is deprecated. The latest 2.x mysql module will be used.') } - if ( $glance::params::api_package_name != $glance::params::registry_package_name ) { - ensure_packages( [$glance::params::registry_package_name], - { - ensure => $package_ensure, - tag => ['openstack'], - } - ) - } + ensure_packages( [$glance::params::registry_package_name], + { + ensure => $package_ensure, + tag => ['openstack'], + } + ) Package[$glance::params::registry_package_name] -> File['/etc/glance/'] Package[$glance::params::registry_package_name] -> Glance_registry_config<||> @@ -354,15 +355,17 @@ if $manage_service { if $enabled { - Exec['glance-manage db_sync'] ~> Service['glance-registry'] + if $sync_db { + Exec['glance-manage db_sync'] ~> Service['glance-registry'] - exec { 'glance-manage db_sync': - command => $::glance::params::db_sync_command, - path => '/usr/bin', - user => 'glance', - refreshonly => true, - logoutput => on_failure, - subscribe => [Package[$glance::params::registry_package_name], File['/etc/glance/glance-registry.conf']], + exec { 'glance-manage db_sync': + command => $::glance::params::db_sync_command, + path => '/usr/bin', + user => 'glance', + refreshonly => true, + logoutput => on_failure, + subscribe => [Package[$glance::params::registry_package_name], File['/etc/glance/glance-registry.conf']], + } } $service_ensure = 'running' } else { diff --git a/glance/spec/classes/glance_api_spec.rb b/glance/spec/classes/glance_api_spec.rb index da77321f4..f796b4909 100644 --- a/glance/spec/classes/glance_api_spec.rb +++ b/glance/spec/classes/glance_api_spec.rb @@ -103,7 +103,6 @@ 'registry_port', 'registry_client_protocol', 'show_image_direct_url', - 'os_region_name', ].each do |config| is_expected.to contain_glance_api_config("DEFAULT/#{config}").with_value(param_hash[config.intern]) end @@ -115,12 +114,20 @@ 'debug', 'registry_host', 'registry_port', - 'os_region_name', ].each do |config| is_expected.to contain_glance_cache_config("DEFAULT/#{config}").with_value(param_hash[config.intern]) end end + it 'is_expected.to lay down default glance_store api and cache config' do + [ + 'os_region_name', + ].each do |config| + is_expected.to contain_glance_cache_config("glance_store/#{config}").with_value(param_hash[config.intern]) + is_expected.to contain_glance_api_config("glance_store/#{config}").with_value(param_hash[config.intern]) + end + end + it 'is_expected.to config db' do is_expected.to contain_glance_api_config('database/connection').with_value(param_hash[:database_connection]) is_expected.to contain_glance_api_config('database/connection').with_value(param_hash[:database_connection]).with_secret(true) @@ -427,9 +434,15 @@ end let(:params) { default_params } - it { is_expected.to contain_package('glance-api').with( - :tag => ['openstack'], - )} + ['present', 'latest'].each do |package_ensure| + context "with package_ensure '#{package_ensure}'" do + let(:params) { default_params.merge({ :package_ensure => package_ensure }) } + it { is_expected.to contain_package('glance-api').with( + :ensure => package_ensure, + :tag => ['openstack'] + )} + end + end end describe 'on RedHat platforms' do @@ -438,9 +451,15 @@ end let(:params) { default_params } - it { is_expected.to contain_package('openstack-glance').with( - :tag => ['openstack'], - )} + ['present', 'latest'].each do |package_ensure| + context "with package_ensure '#{package_ensure}'" do + let(:params) { default_params.merge({ :package_ensure => package_ensure }) } + it { is_expected.to contain_package('openstack-glance-api').with( + :ensure => package_ensure, + :tag => ['openstack'] + )} + end + end end describe 'on unknown platforms' do diff --git a/glance/spec/classes/glance_cache_cleaner_spec.rb b/glance/spec/classes/glance_cache_cleaner_spec.rb index ccb87845b..6f9c34f81 100644 --- a/glance/spec/classes/glance_cache_cleaner_spec.rb +++ b/glance/spec/classes/glance_cache_cleaner_spec.rb @@ -59,7 +59,7 @@ { :osfamily => 'RedHat' } end include_examples 'glance cache cleaner' - it { is_expected.to contain_cron('glance-cache-cleaner').with(:require => 'Package[openstack-glance]')} + it { is_expected.to contain_cron('glance-cache-cleaner').with(:require => 'Package[openstack-glance-api]')} end end diff --git a/glance/spec/classes/glance_cache_pruner_spec.rb b/glance/spec/classes/glance_cache_pruner_spec.rb index 1d08b33fc..cc58932e7 100644 --- a/glance/spec/classes/glance_cache_pruner_spec.rb +++ b/glance/spec/classes/glance_cache_pruner_spec.rb @@ -59,7 +59,7 @@ { :osfamily => 'RedHat' } end include_examples 'glance cache pruner' - it { is_expected.to contain_cron('glance-cache-pruner').with(:require => 'Package[openstack-glance]')} + it { is_expected.to contain_cron('glance-cache-pruner').with(:require => 'Package[openstack-glance-api]')} end end diff --git a/glance/spec/classes/glance_notify_rabbitmq_spec.rb b/glance/spec/classes/glance_notify_rabbitmq_spec.rb index bd9a1473b..7f5f76fa0 100644 --- a/glance/spec/classes/glance_notify_rabbitmq_spec.rb +++ b/glance/spec/classes/glance_notify_rabbitmq_spec.rb @@ -15,17 +15,17 @@ {:rabbit_password => 'pass'} end it { is_expected.to contain_glance_api_config('DEFAULT/notification_driver').with_value('messaging') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_password').with_value('pass') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_password').with_value(params[:rabbit_password]).with_secret(true) } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_host').with_value('localhost') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_port').with_value('5672') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_hosts').with_value('localhost:5672') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_ha_queues').with_value('false') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value('pass') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_password').with_value(params[:rabbit_password]).with_secret(true) } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5672') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost:5672') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') } it { is_expected.to contain_glance_api_config('DEFAULT/amqp_durable_queues').with_value('false') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_virtual_host').with_value('/') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_notification_exchange').with_value('glance') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_notification_topic').with_value('notifications') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_exchange').with_value('glance') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_topic').with_value('notifications') } end describe 'when passing params and use ssl' do @@ -38,15 +38,15 @@ :rabbit_use_ssl => true, :rabbit_durable_queues => true, } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest2') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_host').with_value('localhost2') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_port').with_value('5673') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value('true') } - it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_durable_queues').with_value('true') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_durable_queues').with_value('true') } end end @@ -61,11 +61,11 @@ :kombu_ssl_version => 'TLSv1', } end - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value(true) } - it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_ca_certs').with_value('/etc/ca.cert') } - it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_certfile').with_value('/etc/certfile') } - it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_keyfile').with_value('/etc/key') } - it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_version').with_value('TLSv1') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true) } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('/etc/ca.cert') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('/etc/certfile') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('/etc/key') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') } end describe 'with rabbit ssl disabled' do @@ -80,11 +80,11 @@ } end - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value('false') } - it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_ca_certs').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_certfile').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_keyfile').with_ensure('absent') } - it { is_expected.to contain_glance_api_config('DEFAULT/kombu_ssl_version').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent') } end describe 'when passing params for single rabbit host' do @@ -98,11 +98,11 @@ :rabbit_durable_queues => true, } end - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest2') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_host').with_value('localhost2') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_port').with_value('5673') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_hosts').with_value('localhost2:5673') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_use_ssl').with_value('true') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost2:5673') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') } it { is_expected.to contain_glance_api_config('DEFAULT/amqp_durable_queues').with_value('true') } end @@ -114,12 +114,12 @@ :rabbit_hosts => ['nonlocalhost3:5673', 'nonlocalhost4:5673'] } end - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest3') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_hosts').with_value( + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest3') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_hosts').with_value( 'nonlocalhost3:5673,nonlocalhost4:5673') } - it { is_expected.to contain_glance_api_config('DEFAULT/rabbit_ha_queues').with_value('true') } - it { is_expected.to_not contain_glance_api_config('DEFAULT/rabbit_port') } - it { is_expected.to_not contain_glance_api_config('DEFAULT/rabbit_host') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') } + it { is_expected.to_not contain_glance_api_config('oslo_messaging_rabbit/rabbit_port') } + it { is_expected.to_not contain_glance_api_config('oslo_messaging_rabbit/rabbit_host') } end describe 'when using deprecated params' do diff --git a/glance/spec/classes/glance_registry_spec.rb b/glance/spec/classes/glance_registry_spec.rb index 9e1034daf..34e3ae26c 100644 --- a/glance/spec/classes/glance_registry_spec.rb +++ b/glance/spec/classes/glance_registry_spec.rb @@ -28,6 +28,7 @@ :keystone_user => 'glance', :keystone_password => 'ChangeMe', :purge_config => false, + :sync_db => true, } end @@ -49,6 +50,7 @@ :keystone_tenant => 'admin', :keystone_user => 'admin', :keystone_password => 'ChangeMe', + :sync_db => false, } ].each do |param_set| @@ -74,7 +76,7 @@ it 'is_expected.to only sync the db if the service is enabled' do - if param_hash[:enabled] + if param_hash[:enabled] and param_hash[:sync_db] is_expected.to contain_exec('glance-manage db_sync').with( 'path' => '/usr/bin', 'command' => 'glance-manage --config-file=/etc/glance/glance-registry.conf db_sync', @@ -85,6 +87,12 @@ ) end end + it 'is_expected.to not sync the db if sync_db is set to false' do + + if param_hash[:enabled] and !param_hash[:sync_db] + is_expected.not_to contain_exec('glance-manage db_sync') + end + end it 'is_expected.to configure itself' do [ 'verbose', @@ -339,8 +347,6 @@ { :osfamily => 'Debian' } end - # We only test this on Debian platforms, since on RedHat there isn't a - # separate package for glance registry. ['present', 'latest'].each do |package_ensure| context "with package_ensure '#{package_ensure}'" do let(:params) { default_params.merge({ :package_ensure => package_ensure }) } @@ -358,7 +364,16 @@ end let(:params) { default_params } - it { is_expected.to contain_package('openstack-glance')} + ['present', 'latest'].each do |package_ensure| + context "with package_ensure '#{package_ensure}'" do + let(:params) { default_params.merge({ :package_ensure => package_ensure }) } + it { is_expected.to contain_package('openstack-glance-registry').with( + :ensure => package_ensure, + :tag => ['openstack'] + )} + end + end + end describe 'on unknown platforms' do diff --git a/glance/spec/classes/glance_spec.rb b/glance/spec/classes/glance_spec.rb index 075cec5eb..968b69764 100644 --- a/glance/spec/classes/glance_spec.rb +++ b/glance/spec/classes/glance_spec.rb @@ -49,9 +49,7 @@ end let(:params) { default_params } - it { is_expected.to contain_package('openstack-glance').with( - :tag => ['openstack'], - )} + it { is_expected.to_not contain_package('openstack-glance') } end end