diff --git a/Puppetfile b/Puppetfile index 2d1775d8d..4726c3dcb 100644 --- a/Puppetfile +++ b/Puppetfile @@ -43,7 +43,7 @@ mod 'galera', :git => 'https://github.com/redhat-openstack/puppet-galera.git' mod 'glance', - :commit => 'c76d39605ff311eaba6ca226ac7dac19f86279ed', + :commit => '88b74f869aed0c3fd2fb4b27e0f3956991399414', :git => 'https://github.com/stackforge/puppet-glance.git' mod 'gluster', diff --git a/glance/Gemfile b/glance/Gemfile index 571fd65dc..4c65317ac 100644 --- a/glance/Gemfile +++ b/glance/Gemfile @@ -3,6 +3,7 @@ source 'https://rubygems.org' group :development, :test do gem 'puppetlabs_spec_helper', :require => false gem 'rspec-puppet', '~> 2.1.0', :require => false + gem 'minitest', '~> 4.7', :require => 'minitest/unit' gem 'metadata-json-lint' gem 'puppet-lint-param-docs' diff --git a/glance/README.md b/glance/README.md index f0f225aa8..bec179dbb 100644 --- a/glance/README.md +++ b/glance/README.md @@ -123,6 +123,8 @@ Beaker-Rspec This module has beaker-rspec tests +To run the tests on the default vagrant node: + To run: ```shell @@ -130,6 +132,10 @@ bundle install bundle exec rspec spec/acceptance ``` +For more information on writing and running beaker-rspec tests visit the documentation: + +* https://github.com/puppetlabs/beaker/wiki/How-to-Write-a-Beaker-Test-for-a-Module + Development ----------- diff --git a/glance/manifests/backend/swift.pp b/glance/manifests/backend/swift.pp index 4da76d497..0a2435972 100644 --- a/glance/manifests/backend/swift.pp +++ b/glance/manifests/backend/swift.pp @@ -26,6 +26,9 @@ # == class: glance::backend::swift # [*swift_store_create_container_on_put*] # Optional. Default: 'False' # +# [*swift_store_endpoint_type*] +# Optional. Default: 'internalURL' +# class glance::backend::swift( $swift_store_user, $swift_store_key, @@ -33,7 +36,8 @@ # == class: glance::backend::swift $swift_store_container = 'glance', $swift_store_auth_version = '2', $swift_store_large_object_size = '5120', - $swift_store_create_container_on_put = false + $swift_store_create_container_on_put = false, + $swift_store_endpoint_type = 'internalURL' ) { glance_api_config { @@ -47,6 +51,8 @@ # == class: glance::backend::swift value => $swift_store_create_container_on_put; 'DEFAULT/swift_store_large_object_size': value => $swift_store_large_object_size; + 'glance_store/swift_store_endpoint_type': + value => $swift_store_endpoint_type; } glance_cache_config { diff --git a/glance/manifests/params.pp b/glance/manifests/params.pp index 61df5b8db..6fbed16a2 100644 --- a/glance/manifests/params.pp +++ b/glance/manifests/params.pp @@ -3,7 +3,6 @@ class glance::params { $client_package_name = 'python-glanceclient' - $pyceph_package_name = 'python-ceph' $cache_cleaner_command = 'glance-cache-cleaner' $cache_pruner_command = 'glance-cache-pruner' @@ -15,6 +14,11 @@ $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' + if ($::operatingsystem != 'fedora' and versioncmp($::operatingsystemrelease, '7') < 0) { + $pyceph_package_name = 'python-ceph' + } else { + $pyceph_package_name = 'python-rbd' + } } 'Debian': { $api_package_name = 'glance-api' @@ -22,6 +26,7 @@ $api_service_name = 'glance-api' $registry_service_name = 'glance-registry' $db_sync_command = 'glance-manage --config-file=/etc/glance/glance-registry.conf db_sync' + $pyceph_package_name = 'python-ceph' } default: { fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat and Debian") diff --git a/glance/spec/acceptance/class_spec.rb b/glance/spec/acceptance/basic_glance_spec.rb similarity index 73% rename from glance/spec/acceptance/class_spec.rb rename to glance/spec/acceptance/basic_glance_spec.rb index c580d602d..824b97902 100644 --- a/glance/spec/acceptance/class_spec.rb +++ b/glance/spec/acceptance/basic_glance_spec.rb @@ -12,24 +12,30 @@ 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, + class { '::openstack_extras::repo::debian::ubuntu': + release => 'kilo', + package_require => true, } } 'RedHat': { - include ::epel # Get our epel on + class { '::openstack_extras::repo::redhat::redhat': + # Kilo is not GA yet, so let's use the testing repo + manage_rdo => false, + repo_hash => { + 'rdo-kilo-testing' => { + 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/testing/el7/', + # packages are not GA so not signed + 'gpgcheck' => '0', + 'priority' => 97, + }, + }, + } + } + default: { + fail("Unsupported osfamily (${::osfamily})") } } + class { '::mysql::server': } # Keystone resources, needed by Glance to run @@ -68,7 +74,7 @@ class { '::glance::keystone::auth': class { '::glance::api': database_connection => 'mysql://glance:a_big_secret@127.0.0.1/glance?charset=utf8', verbose => false, - keystone_password => 'big_secret', + keystone_password => 'a_big_secret', } class { '::glance::registry': database_connection => 'mysql://glance:a_big_secret@127.0.0.1/glance?charset=utf8', diff --git a/glance/spec/acceptance/nodesets/centos-70-x64.yml b/glance/spec/acceptance/nodesets/centos-70-x64.yml deleted file mode 100644 index cffc417f0..000000000 --- a/glance/spec/acceptance/nodesets/centos-70-x64.yml +++ /dev/null @@ -1,9 +0,0 @@ -HOSTS: - centos-70-x64: - roles: - - master - platform: el-7-x86_64 - box : puppetlabs/centos-7.0-64-nocm - hypervisor : vagrant -CONFIG: - type: foss diff --git a/glance/spec/acceptance/nodesets/default.yml b/glance/spec/acceptance/nodesets/default.yml index 0070b84c7..da9eac860 100644 --- a/glance/spec/acceptance/nodesets/default.yml +++ b/glance/spec/acceptance/nodesets/default.yml @@ -1,11 +1,10 @@ HOSTS: - ubuntu-server-1404-x64: + ubuntu-14.04-amd64: roles: - master platform: ubuntu-14.04-amd64 - box : trusty-server-cloudimg-amd64-vagrant-disk1 - box_url : puppetlabs/ubuntu-14.04-64-nocm + box : puppetlabs/ubuntu-14.04-64-nocm + box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm hypervisor : vagrant CONFIG: - log_level : debug - type: git + type: foss diff --git a/glance/spec/acceptance/nodesets/nodepool-trusty.yml b/glance/spec/acceptance/nodesets/nodepool-trusty.yml index 757ba9851..a2c1ecc63 100644 --- a/glance/spec/acceptance/nodesets/nodepool-trusty.yml +++ b/glance/spec/acceptance/nodesets/nodepool-trusty.yml @@ -1,5 +1,5 @@ HOSTS: - ubuntu-server-1404-x64: + ubuntu-14.04-amd64: roles: - master platform: ubuntu-14.04-amd64 diff --git a/glance/spec/acceptance/nodesets/nodepool.yml b/glance/spec/acceptance/nodesets/nodepool.yml deleted file mode 100644 index 757ba9851..000000000 --- a/glance/spec/acceptance/nodesets/nodepool.yml +++ /dev/null @@ -1,9 +0,0 @@ -HOSTS: - ubuntu-server-1404-x64: - roles: - - master - platform: ubuntu-14.04-amd64 - hypervisor : none - ip: 127.0.0.1 -CONFIG: - type: foss diff --git a/glance/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/glance/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml deleted file mode 100644 index 0070b84c7..000000000 --- a/glance/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +++ /dev/null @@ -1,11 +0,0 @@ -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 diff --git a/glance/spec/classes/glance_backend_rbd_spec.rb b/glance/spec/classes/glance_backend_rbd_spec.rb index 4ca1c18db..0de3daf6c 100644 --- a/glance/spec/classes/glance_backend_rbd_spec.rb +++ b/glance/spec/classes/glance_backend_rbd_spec.rb @@ -42,4 +42,31 @@ ) } end + + describe 'package on RedHat platform el6' do + let :facts do + { + :osfamily => 'RedHat', + :operatingsystemrelease => '6.5', + } + end + it { is_expected.to contain_package('python-ceph').with( + :name => 'python-ceph', + :ensure => 'present' + ) + } + end + describe 'package on RedHat platform el7' do + let :facts do + { + :osfamily => 'RedHat', + :operatingsystemrelease => '7.0' + } + end + it { is_expected.to contain_package('python-ceph').with( + :name => 'python-rbd', + :ensure => 'present' + ) + } + end end diff --git a/glance/spec/classes/glance_backend_swift_spec.rb b/glance/spec/classes/glance_backend_swift_spec.rb index fc7584566..d9e3b2216 100644 --- a/glance/spec/classes/glance_backend_swift_spec.rb +++ b/glance/spec/classes/glance_backend_swift_spec.rb @@ -29,6 +29,7 @@ is_expected.to contain_glance_api_config('glance_store/swift_store_auth_address').with_value('127.0.0.1:5000/v2.0/') is_expected.to contain_glance_api_config('DEFAULT/swift_store_container').with_value('glance') is_expected.to contain_glance_api_config('DEFAULT/swift_store_create_container_on_put').with_value(false) + is_expected.to contain_glance_api_config('glance_store/swift_store_endpoint_type').with_value('internalURL') end it 'configures glance-cache.conf' do @@ -51,7 +52,8 @@ :swift_store_large_object_size => '100', :swift_store_auth_address => '127.0.0.2:8080/v1.0/', :swift_store_container => 'swift', - :swift_store_create_container_on_put => true + :swift_store_create_container_on_put => true, + :swift_store_endpoint_type => 'publicURL' } end @@ -61,6 +63,7 @@ is_expected.to contain_glance_api_config('DEFAULT/swift_store_auth_version').with_value('1') is_expected.to contain_glance_api_config('DEFAULT/swift_store_large_object_size').with_value('100') is_expected.to contain_glance_api_config('glance_store/swift_store_auth_address').with_value('127.0.0.2:8080/v1.0/') + is_expected.to contain_glance_api_config('glance_store/swift_store_endpoint_type').with_value('publicURL') end it 'configures glance-cache.conf' do diff --git a/glance/spec/spec_helper_acceptance.rb b/glance/spec/spec_helper_acceptance.rb index ea8ed6ef2..3d86d13f5 100644 --- a/glance/spec/spec_helper_acceptance.rb +++ b/glance/spec/spec_helper_acceptance.rb @@ -28,14 +28,15 @@ # install library modules from the forge on host, puppet('module','install', '--force', 'puppetlabs-mysql', '--version', '3.2.0'), { :acceptable_exit_codes => [0,1] } on host, puppet('module','install','dprince/qpid'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module','install','puppetlabs-apt', '--version', '1.8.0'), { :acceptable_exit_codes => [0,1] } on host, puppet('module','install','puppetlabs-inifile'), { :acceptable_exit_codes => [0,1] } on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } - on host, puppet('module','install','puppetlabs-rabbitmq'), { :acceptable_exit_codes => [0,1] } on host, puppet('module','install','stahnma-epel'), { :acceptable_exit_codes => [0,1] } # install puppet modules from git, use master shell('git clone https://git.openstack.org/stackforge/puppet-openstacklib /etc/puppet/modules/openstacklib') shell('git clone https://git.openstack.org/stackforge/puppet-keystone /etc/puppet/modules/keystone') + shell('git clone https://git.openstack.org/stackforge/puppet-openstack_extras /etc/puppet/modules/openstack_extras') # Install the module being tested puppet_module_install(:source => proj_root, :module_name => 'glance')