Skip to content

Commit

Permalink
Update puppet-glance to latest commit
Browse files Browse the repository at this point in the history
Required by RDO Kilo packaging.

Change-Id: Ic65a30d6e2bc030b07b6788e34472052fda192c3
  • Loading branch information
javierpena committed Apr 16, 2015
1 parent b6d2c6b commit 001dc0a
Show file tree
Hide file tree
Showing 13 changed files with 154 additions and 130 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 3 additions & 1 deletion glance/.fixtures.yml
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
25 changes: 14 additions & 11 deletions glance/manifests/api.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -184,6 +187,7 @@
#
class glance::api(
$keystone_password,
$package_ensure = 'present',
$verbose = false,
$debug = false,
$bind_host = '0.0.0.0',
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
18 changes: 1 addition & 17 deletions glance/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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'],
}
}
}
46 changes: 23 additions & 23 deletions glance/manifests/notify/rabbitmq.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions glance/manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
41 changes: 22 additions & 19 deletions glance/manifests/registry.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
#
Expand Down Expand Up @@ -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',
Expand All @@ -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<||>
Expand Down Expand Up @@ -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 {
Expand Down
35 changes: 27 additions & 8 deletions glance/spec/classes/glance_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion glance/spec/classes/glance_cache_cleaner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion glance/spec/classes/glance_cache_pruner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit 001dc0a

Please sign in to comment.