Skip to content

Commit

Permalink
Stabilize openstack liberty modules.
Browse files Browse the repository at this point in the history
Update ceilometer to 23102fbff3e8b7e45e20d0d82dd6cedb6bd54bb1

23102fbff3e8b7e45e20d0d82dd6cedb6bd54bb1 Support of PyMySQL driver for MySQL backend

Change-Id: If59577a18df9c34ff3f170a9beb3f671b1562bd1

Update trove to 651b00eeeee5da46bc08201055c7cac445802181

651b00eeeee5da46bc08201055c7cac445802181 Remove trove ubuntu package hack

Change-Id: Ice6ce0065b6561747e800282be45b2a09c0f07be
  • Loading branch information
jguiditta authored and strider committed Feb 29, 2016
1 parent f9ec276 commit c90f31a
Show file tree
Hide file tree
Showing 18 changed files with 114 additions and 61 deletions.
4 changes: 2 additions & 2 deletions Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mod 'cassandra',
:git => 'https://github.com/locp/cassandra.git'

mod 'ceilometer',
:commit => '4446631c8928c4eb7d29e90e3ecbba119a6f1ec4',
:commit => '23102fbff3e8b7e45e20d0d82dd6cedb6bd54bb1',
:git => 'https://github.com/openstack/puppet-ceilometer.git'

mod 'ceph',
Expand Down Expand Up @@ -247,7 +247,7 @@ mod 'tripleo',
:git => 'https://github.com/openstack/puppet-tripleo.git'

mod 'trove',
:commit => 'dac27f13f2d376d09511811ea2c84f8b06cd969d',
:commit => '651b00eeeee5da46bc08201055c7cac445802181',
:git => 'https://github.com/openstack/puppet-trove'

mod 'tuskar',
Expand Down
10 changes: 7 additions & 3 deletions ceilometer/manifests/db.pp
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,17 @@
Package<| title == 'ceilometer-common' |> -> Class['ceilometer::db']

validate_re($database_connection,
'(sqlite|mysql|postgresql|mongodb):\/\/(\S+:\S+@\S+\/\S+)?')
'^(sqlite|mysql(\+pymysql)?|postgresql|mongodb):\/\/(\S+:\S+@\S+\/\S+)?')

case $database_connection {
/^mysql:\/\//: {
$backend_package = false
/^mysql(\+pymysql)?:\/\//: {
require 'mysql::bindings'
require 'mysql::bindings::python'
if $database_connection =~ /^mysql\+pymysql/ {
$backend_package = $::ceilometer::params::pymysql_package_name
} else {
$backend_package = false
}
}
/^postgresql:\/\//: {
$backend_package = false
Expand Down
2 changes: 2 additions & 0 deletions ceilometer/manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
$ceilometer_wsgi_script_path = '/var/www/cgi-bin/ceilometer'
$ceilometer_wsgi_script_source = '/usr/lib/python2.7/site-packages/ceilometer/api/app.wsgi'
$sqlite_package_name = undef
$pymysql_package_name = undef
}
'Debian': {
# package names
Expand All @@ -55,6 +56,7 @@
# db packages
$pymongo_package_name = 'python-pymongo'
$sqlite_package_name = 'python-pysqlite2'
$pymysql_package_name = 'python-pymysql'

# Operating system specific
case $::operatingsystem {
Expand Down
4 changes: 2 additions & 2 deletions ceilometer/spec/acceptance/ceilometer_with_mysql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class { '::keystone::db::mysql':
class { '::keystone':
verbose => true,
debug => true,
database_connection => 'mysql://keystone:[email protected]/keystone',
database_connection => 'mysql+pymysql://keystone:[email protected]/keystone',
admin_token => 'admin_token',
enabled => true,
}
Expand All @@ -66,7 +66,7 @@ class { '::ceilometer::db::mysql':
password => 'a_big_secret',
}
class { '::ceilometer::db':
database_connection => 'mysql://ceilometer:[email protected]/ceilometer?charset=utf8',
database_connection => 'mysql+pymysql://ceilometer:[email protected]/ceilometer?charset=utf8',
}
class { '::ceilometer::keystone::auth':
password => 'a_big_secret',
Expand Down
2 changes: 1 addition & 1 deletion ceilometer/spec/acceptance/ceilometer_wsgi_apache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class { '::ceilometer::db::mysql':
password => 'a_big_secret',
}
class { '::ceilometer::db':
database_connection => 'mysql://ceilometer:[email protected]/ceilometer?charset=utf8',
database_connection => 'mysql+pymysql://ceilometer:[email protected]/ceilometer?charset=utf8',
}
class { '::ceilometer::keystone::auth':
password => 'a_big_secret',
Expand Down
40 changes: 40 additions & 0 deletions ceilometer/spec/classes/ceilometer_db_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@

end

context 'with pymysql connection' do
let :params do
{ :database_connection => 'mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer' }
end

it { is_expected.to contain_class('ceilometer::params') }
it { is_expected.to contain_class('ceilometer::db::sync') }
it { is_expected.to contain_ceilometer_config('database/connection').with_value('mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer').with_secret(true) }
end

context 'with mongodb backend and replica set' do
let :params do
{ :database_connection => 'mongodb://localhost:1234/ceilometer',
Expand Down Expand Up @@ -75,6 +85,14 @@
end
end

context 'with incorrect pymysql database_connection string' do
let :params do
{ :database_connection => 'foo+pymysql://ceilometer:ceilometer@localhost/ceilometer', }
end

it_raises 'a Puppet::Error', /validate_re/
end

end

context 'on Debian platforms' do
Expand All @@ -87,6 +105,20 @@

it_configures 'ceilometer::db'

context 'using pymysql driver' do
let :params do
{ :database_connection => 'mysql+pymysql:///ceilometer:ceilometer@localhost/ceilometer', }
end

it 'install the proper backend package' do
is_expected.to contain_package('ceilometer-backend-package').with(
:ensure => 'present',
:name => 'python-pymysql',
:tag => 'openstack'
)
end
end

context 'with sqlite backend' do
let :params do
{ :database_connection => 'sqlite:///var/lib/ceilometer.db', }
Expand All @@ -111,6 +143,14 @@
end

it_configures 'ceilometer::db'

context 'using pymysql driver' do
let :params do
{ :database_connection => 'mysql+pymysql:///ceilometer:ceilometer@localhost/ceilometer', }
end

it { is_expected.not_to contain_package('ceilometer-backend-package') }
end
end

end
Expand Down
3 changes: 3 additions & 0 deletions trove/lib/puppet/type/trove_api_paste_ini.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,7 @@ def should_to_s( newvalue )
defaultto('<SERVICE DEFAULT>')
end

autorequire(:package) do
'trove-api'
end
end
3 changes: 3 additions & 0 deletions trove/lib/puppet/type/trove_conductor_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ def should_to_s( newvalue )
defaultto('<SERVICE DEFAULT>')
end

autorequire(:package) do
'trove-conductor'
end
end
3 changes: 3 additions & 0 deletions trove/lib/puppet/type/trove_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ def should_to_s( newvalue )
defaultto('<SERVICE DEFAULT>')
end

autorequire(:package) do
'trove-api'
end
end
3 changes: 3 additions & 0 deletions trove/lib/puppet/type/trove_guestagent_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ def should_to_s( newvalue )
defaultto('<SERVICE DEFAULT>')
end

autorequire(:package) do
'trove-guestagent'
end
end
9 changes: 0 additions & 9 deletions trove/manifests/api.pp
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,7 @@

Trove_config<||> ~> Exec['post-trove_config']
Trove_config<||> ~> Service['trove-api']
Package['trove-api'] -> Trove_api_paste_ini<||>
Trove_api_paste_ini<||> ~> Service['trove-api']
# Trove db sync is broken in Ubuntu packaging
# This is a temporary fix until it's fixed in packaging.
# https://bugs.launchpad.net/ubuntu/+source/openstack-trove/+bug/1451134
file { '/etc/trove/trove.conf':
require => File['/etc/trove'],
}
File['/etc/trove/trove.conf'] -> Trove_config<||>
Trove_config<||> -> Package[$::trove::params::api_package_name]

# basic service config
trove_config {
Expand Down
8 changes: 0 additions & 8 deletions trove/manifests/conductor.pp
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@

Trove_conductor_config<||> ~> Exec['post-trove_config']
Trove_conductor_config<||> ~> Service['trove-conductor']
# Trove db sync is broken in Ubuntu packaging
# This is a temporary fix until it's fixed in packaging.
# https://bugs.launchpad.net/ubuntu/+source/openstack-trove/+bug/1451134
file { '/etc/trove/trove-conductor.conf':
require => File['/etc/trove'],
}
File['/etc/trove/trove-conductor.conf'] -> Trove_conductor_config<||>
Trove_conductor_config<||> -> Package[$::trove::params::conductor_package_name]

if $::trove::database_connection {
if($::trove::database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
Expand Down
1 change: 0 additions & 1 deletion trove/manifests/db/sync.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@
user => 'trove',
refreshonly => true,
subscribe => Trove_config['database/connection'],
require => Package['trove-api'],
}
}
8 changes: 0 additions & 8 deletions trove/manifests/guestagent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@

Trove_guestagent_config<||> ~> Exec['post-trove_config']
Trove_guestagent_config<||> ~> Service['trove-guestagent']
# Trove db sync is broken in Ubuntu packaging
# This is a temporary fix until it's fixed in packaging.
# https://bugs.launchpad.net/ubuntu/+source/openstack-trove/+bug/1451134
file { '/etc/trove/trove-guestagent.conf':
require => File['/etc/trove'],
}
File['/etc/trove/trove-guestagent.conf'] -> Trove_guestagent_config<||>
Trove_guestagent_config<||> -> Package[$::trove::params::guestagent_package_name]

# basic service config
trove_guestagent_config {
Expand Down
31 changes: 4 additions & 27 deletions trove/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -308,32 +308,9 @@
trove_config { 'DEFAULT/neutron_url': ensure => absent }
}

if $::osfamily == 'RedHat' {
# TO-DO(mmagr): Conditional should be removed as soon as following bug
# is really fixed. On Ubuntu trove-common is not installable without already
# running database and correctly filled trove.conf:
# https://bugs.launchpad.net/ubuntu/+source/openstack-trove/+bug/1365561
package { 'trove':
ensure => $package_ensure,
name => $::trove::params::common_package_name,
tag => ['openstack', 'trove-package'],
}
$group_require = Package['trove']
} else {
$group_require = undef
package { 'trove':
ensure => $package_ensure,
name => $::trove::params::common_package_name,
tag => ['openstack', 'trove-package'],
}

group { 'trove':
ensure => 'present',
name => 'trove',
system => true,
require => $group_require
}

file { '/etc/trove/':
ensure => directory,
group => 'trove',
require => Group['trove']
}

}
17 changes: 17 additions & 0 deletions trove/spec/unit/type/trove_conductor_config_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'puppet/type/trove_conductor_config'

describe 'Puppet::Type.type(:trove_conductor_config)' do
before :each do
@trove_conductor_config = Puppet::Type.type(:trove_conductor_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end

it 'should autorequire the package that installs the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'trove-conductor')
catalog.add_resource package, @trove_conductor_config
dependency = @trove_conductor_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@trove_conductor_config)
expect(dependency[0].source).to eq(package)
end
end
17 changes: 17 additions & 0 deletions trove/spec/unit/type/trove_conductor_guestagent_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'puppet/type/trove_guestagent_config'

describe 'Puppet::Type.type(:trove_guestagent_config)' do
before :each do
@trove_guestagent_config = Puppet::Type.type(:trove_guestagent_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end

it 'should autorequire the package that installs the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'trove-guestagent')
catalog.add_resource package, @trove_guestagent_config
dependency = @trove_guestagent_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@trove_guestagent_config)
expect(dependency[0].source).to eq(package)
end
end
10 changes: 10 additions & 0 deletions trove/spec/unit/type/trove_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,14 @@
@trove_config[:ensure] = :latest
}.to raise_error(Puppet::Error, /Invalid value/)
end

it 'should autorequire the package that installs the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'trove-api')
catalog.add_resource package, @trove_config
dependency = @trove_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@trove_config)
expect(dependency[0].source).to eq(package)
end
end

0 comments on commit c90f31a

Please sign in to comment.