Skip to content

Commit

Permalink
Update glance to 0db42a6a60bd4952f795d61ea26ed299e8c35bc8
Browse files Browse the repository at this point in the history
0db42a6a60bd4952f795d61ea26ed299e8c35bc8 Merge "Fix spec tests for RSpec 3.x and Puppet 4.x"
1d388344661b056c45e79e3c189f82db6ed0d69b make service description configurable
60de7b77df0d3705e7b18cf346651d3922b47e3d Fix spec tests for RSpec 3.x and Puppet 4.x
b76fbcbea34b510191964cc3ed6a4c8e6f2acbfe glance provider: pick os_region_name from DEFAULT
9f345f97d12af09685c86fb236c3bf44273b10d6 Bump rspec-puppet to 2.1.0
15e08072566e7c05abeff9c73079fc16f1b9cb8f Merge "Revert "Revert "Fix os_region_name in provider"""
5609850a577050aa7a6692e41bbd3abc5cd1fed7 Merge "Revert "Fix os_region_name in provider""
b803a9a983bfd09c40e94bcb8a5ca10348af38ae Merge "Revert "Move rabbit/kombu settings to oslo_messaging_rabbit section""
a758389de6e6b22a20a716905f55df973b11bef9 Merge "MySQL: change default MySQL collate to utf8_general_ci"
2f614cf9fd15a5348ac11eb617e63883598f0497 MySQL: change default MySQL collate to utf8_general_ci
79d307044a3b2189278fdcb230625a6eae282d27 Beaker tests
62c42a5f6122d146f8c4e292c878cdd3e958a85f Revert "Revert "Fix os_region_name in provider""
e2301958e9dd4086fb6f5689499e5bb39e87e208 Revert "Fix os_region_name in provider"
d302170d260f4e6585fedc1b4709c953d0491c56 Revert "Move rabbit/kombu settings to oslo_messaging_rabbit section"
  • Loading branch information
xbezdick committed May 11, 2015
1 parent c47a5b9 commit 9063c86
Show file tree
Hide file tree
Showing 22 changed files with 292 additions and 91 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ mod 'galera',
:git => 'https://github.com/redhat-openstack/puppet-galera.git'

mod 'glance',
:commit => 'eaddd54d8ac87571a01046b5da7dbca33f3b3a59',
:commit => '0db42a6a60bd4952f795d61ea26ed299e8c35bc8',
:git => 'https://github.com/stackforge/puppet-glance.git'

mod 'gluster',
Expand Down
3 changes: 2 additions & 1 deletion glance/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'

group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-puppet', '~> 2.0.0', :require => false
gem 'rspec-puppet', '~> 2.1.0', :require => false

gem 'metadata-json-lint'
gem 'puppet-lint-param-docs'
Expand All @@ -16,6 +16,7 @@ group :development, :test do
gem 'puppet-lint-variable_contains_upcase'
gem 'puppet-lint-numericvariable'

gem 'beaker-rspec', '~> 2.2.4', :require => false
gem 'json'
gem 'webmock'
end
Expand Down
12 changes: 12 additions & 0 deletions glance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ Limitations

* Only supports configuring the file, swift and rbd storage backends.

Beaker-Rspec
------------

This module has beaker-rspec tests

To run:

```shell
bundle install
bundle exec rspec spec/acceptance
```

Development
-----------

Expand Down
8 changes: 4 additions & 4 deletions glance/lib/puppet/provider/glance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def self.get_glance_credentials
glance_file['keystone_authtoken']['admin_tenant_name'] and
glance_file['keystone_authtoken']['admin_user'] and
glance_file['keystone_authtoken']['admin_password'] and
glance_file['glance_store']['os_region_name']
glance_file['DEFAULT']['os_region_name']

g = {}
g['auth_host'] = glance_file['keystone_authtoken']['auth_host'].strip
Expand All @@ -25,7 +25,7 @@ def self.get_glance_credentials
g['admin_tenant_name'] = glance_file['keystone_authtoken']['admin_tenant_name'].strip
g['admin_user'] = glance_file['keystone_authtoken']['admin_user'].strip
g['admin_password'] = glance_file['keystone_authtoken']['admin_password'].strip
g['os_region_name'] = glance_file['glance_store']['os_region_name'].strip
g['os_region_name'] = glance_file['DEFAULT']['os_region_name'].strip

# auth_admin_prefix not required to be set.
g['auth_admin_prefix'] = (glance_file['keystone_authtoken']['auth_admin_prefix'] || '').strip
Expand All @@ -36,14 +36,14 @@ def self.get_glance_credentials
glance_file['keystone_authtoken']['admin_tenant_name'] and
glance_file['keystone_authtoken']['admin_user'] and
glance_file['keystone_authtoken']['admin_password'] and
glance_file['glance_store']['os_region_name']
glance_file['DEFAULT']['os_region_name']

g = {}
g['identity_uri'] = glance_file['keystone_authtoken']['identity_uri'].strip
g['admin_tenant_name'] = glance_file['keystone_authtoken']['admin_tenant_name'].strip
g['admin_user'] = glance_file['keystone_authtoken']['admin_user'].strip
g['admin_password'] = glance_file['keystone_authtoken']['admin_password'].strip
g['os_region_name'] = glance_file['glance_store']['os_region_name'].strip
g['os_region_name'] = glance_file['DEFAULT']['os_region_name'].strip

return g
else
Expand Down
8 changes: 4 additions & 4 deletions glance/manifests/api.pp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
'DEFAULT/workers': value => $workers;
'DEFAULT/show_image_direct_url': value => $show_image_direct_url;
'DEFAULT/image_cache_dir': value => $image_cache_dir;
'glance_store/os_region_name': value => $os_region_name;
'DEFAULT/os_region_name': value => $os_region_name;
}

# known_stores config
Expand All @@ -314,9 +314,9 @@
}

glance_cache_config {
'DEFAULT/verbose': value => $verbose;
'DEFAULT/debug': value => $debug;
'glance_store/os_region_name': value => $os_region_name;
'DEFAULT/verbose': value => $verbose;
'DEFAULT/debug': value => $debug;
'DEFAULT/os_region_name': value => $os_region_name;
}

# configure api service to connect registry service
Expand Down
4 changes: 2 additions & 2 deletions glance/manifests/db/mysql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# the database charset. Optional. Defaults to 'utf8'
#
# [*collate*]
# the database collation. Optional. Defaults to 'utf8_unicode_ci'
# the database collation. Optional. Defaults to 'utf8_general_ci'
#
# [*mysql_module*]
# (optional) Deprecated. Does nothing.
Expand All @@ -40,7 +40,7 @@
$host = '127.0.0.1',
$allowed_hosts = undef,
$charset = 'utf8',
$collate = 'utf8_unicode_ci',
$collate = 'utf8_general_ci',
$cluster_id = 'localzone',
$mysql_module = undef,
) {
Expand Down
8 changes: 6 additions & 2 deletions glance/manifests/keystone/auth.pp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
# [*admin_protocol*]
# Protocol for admin endpoint. Optional. Defaults to 'http'.
#
# [*service_description*]
# Description for keystone service. Optional. Defaults to 'OpenStack Image Service''.
#
class glance::keystone::auth(
$password,
$email = 'glance@localhost',
Expand All @@ -74,7 +77,8 @@
$tenant = 'services',
$public_protocol = 'http',
$admin_protocol = 'http',
$internal_protocol = 'http'
$internal_protocol = 'http',
$service_description = 'OpenStack Image Service',
) {

if $service_name == undef {
Expand All @@ -92,7 +96,7 @@
configure_user_role => $configure_user_role,
configure_endpoint => $configure_endpoint,
service_type => $service_type,
service_description => 'OpenStack Image Service',
service_description => $service_description,
service_name => $real_service_name,
region => $region,
password => $password,
Expand Down
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 {
'oslo_messaging_rabbit/rabbit_hosts': value => join($rabbit_hosts, ',');
'oslo_messaging_rabbit/rabbit_ha_queues': value => true
'DEFAULT/rabbit_hosts': value => join($rabbit_hosts, ',');
'DEFAULT/rabbit_ha_queues': value => true
}
} else {
glance_api_config {
'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
'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
}
}

glance_api_config {
'DEFAULT/notification_driver': value => $notification_driver;
'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/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;
'DEFAULT/amqp_durable_queues': value => $amqp_durable_queues_real;
}

if $rabbit_use_ssl {
glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version }
glance_api_config { 'DEFAULT/kombu_ssl_version': value => $kombu_ssl_version }

if $kombu_ssl_ca_certs {
glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs }
glance_api_config { 'DEFAULT/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs }
} else {
glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent}
glance_api_config { 'DEFAULT/kombu_ssl_ca_certs': ensure => absent}
}

if $kombu_ssl_certfile {
glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile }
glance_api_config { 'DEFAULT/kombu_ssl_certfile': value => $kombu_ssl_certfile }
} else {
glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent}
glance_api_config { 'DEFAULT/kombu_ssl_certfile': ensure => absent}
}

if $kombu_ssl_keyfile {
glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile }
glance_api_config { 'DEFAULT/kombu_ssl_keyfile': value => $kombu_ssl_keyfile }
} else {
glance_api_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent}
glance_api_config { 'DEFAULT/kombu_ssl_keyfile': ensure => absent}
}
} else {
glance_api_config {
'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;
'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;
}
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
86 changes: 86 additions & 0 deletions glance/spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
require 'spec_helper_acceptance'

describe 'glance class' do

context 'default parameters' do

it 'should work with no errors' do
pp= <<-EOS
Exec { logoutput => 'on_failure' }
# Common resources
case $::osfamily {
'Debian': {
include ::apt
# some packages are not autoupgraded in trusty.
# it will be fixed in liberty, but broken in kilo.
$need_to_be_upgraded = ['python-tz', 'python-pbr']
apt::source { 'trusty-updates-kilo':
location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu/',
release => 'trusty-updates',
required_packages => 'ubuntu-cloud-keyring',
repos => 'kilo/main',
trusted_source => true,
} ->
package { $need_to_be_upgraded:
ensure => latest,
}
}
'RedHat': {
include ::epel # Get our epel on
}
}
class { '::mysql::server': }
# Keystone resources, needed by Glance to run
class { '::keystone::db::mysql':
# https://bugs.launchpad.net/puppet-keystone/+bug/1446375
collate => 'utf8_general_ci',
password => 'keystone',
}
class { '::keystone':
verbose => true,
debug => true,
database_connection => 'mysql://keystone:[email protected]/keystone',
admin_token => 'admin_token',
enabled => true,
}
class { '::keystone::roles::admin':
email => '[email protected]',
password => 'a_big_secret',
}
class { '::keystone::endpoint':
public_url => "https://${::fqdn}:5000/",
admin_url => "https://${::fqdn}:35357/",
}
# Glance resources
include ::glance
include ::glance::client
class { '::glance::db::mysql':
# https://bugs.launchpad.net/puppet-glance/+bug/1446375
collate => 'utf8_general_ci',
password => 'a_big_secret',
}
class { '::glance::keystone::auth':
password => 'a_big_secret',
}
class { '::glance::api':
database_connection => 'mysql://glance:[email protected]/glance?charset=utf8',
verbose => false,
keystone_password => 'big_secret',
}
class { '::glance::registry':
database_connection => 'mysql://glance:[email protected]/glance?charset=utf8',
verbose => false,
keystone_password => 'a_big_secret',
}
EOS

# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end

end
end
9 changes: 9 additions & 0 deletions glance/spec/acceptance/nodesets/centos-70-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HOSTS:
centos-70-x64:
roles:
- master
platform: el-7-x86_64
box : puppetlabs/centos-7.0-64-nocm
hypervisor : vagrant
CONFIG:
type: foss
11 changes: 11 additions & 0 deletions glance/spec/acceptance/nodesets/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
ubuntu-server-1404-x64:
roles:
- master
platform: ubuntu-14.04-amd64
box : trusty-server-cloudimg-amd64-vagrant-disk1
box_url : puppetlabs/ubuntu-14.04-64-nocm
hypervisor : vagrant
CONFIG:
log_level : debug
type: git
9 changes: 9 additions & 0 deletions glance/spec/acceptance/nodesets/nodepool-centos7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HOSTS:
centos-70-x64:
roles:
- master
platform: el-7-x86_64
hypervisor : none
ip: 127.0.0.1
CONFIG:
type: foss
9 changes: 9 additions & 0 deletions glance/spec/acceptance/nodesets/nodepool-trusty.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HOSTS:
ubuntu-server-1404-x64:
roles:
- master
platform: ubuntu-14.04-amd64
hypervisor : none
ip: 127.0.0.1
CONFIG:
type: foss
9 changes: 9 additions & 0 deletions glance/spec/acceptance/nodesets/nodepool.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HOSTS:
ubuntu-server-1404-x64:
roles:
- master
platform: ubuntu-14.04-amd64
hypervisor : none
ip: 127.0.0.1
CONFIG:
type: foss
11 changes: 11 additions & 0 deletions glance/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
ubuntu-server-1404-x64:
roles:
- master
platform: ubuntu-14.04-amd64
box : trusty-server-cloudimg-amd64-vagrant-disk1
box_url : puppetlabs/ubuntu-14.04-64-nocm
hypervisor : vagrant
CONFIG:
log_level : debug
type: git
Loading

0 comments on commit 9063c86

Please sign in to comment.