From 0f3cbadffffe6c32d2b74eeda74bcabd7cc5c709 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Tue, 8 Sep 2015 14:10:29 +0200 Subject: [PATCH] Remove trove ubuntu package hack Bug #1365561 has been marked as fixed so it should be safe to remove hack adding group and file before installing package. Change-Id: Id447a47a056a41d8c98b01d6769f4121a36d7aae --- lib/puppet/type/trove_api_paste_ini.rb | 3 ++ lib/puppet/type/trove_conductor_config.rb | 3 ++ lib/puppet/type/trove_config.rb | 3 ++ lib/puppet/type/trove_guestagent_config.rb | 3 ++ manifests/api.pp | 9 ------ manifests/conductor.pp | 8 ----- manifests/db/sync.pp | 1 - manifests/guestagent.pp | 8 ----- manifests/init.pp | 31 +++---------------- spec/unit/type/trove_conductor_config_spec.rb | 17 ++++++++++ .../type/trove_conductor_guestagent_spec.rb | 17 ++++++++++ spec/unit/type/trove_config_spec.rb | 10 ++++++ 12 files changed, 60 insertions(+), 53 deletions(-) create mode 100644 spec/unit/type/trove_conductor_config_spec.rb create mode 100644 spec/unit/type/trove_conductor_guestagent_spec.rb diff --git a/lib/puppet/type/trove_api_paste_ini.rb b/lib/puppet/type/trove_api_paste_ini.rb index ae7c6d3d..8c402091 100644 --- a/lib/puppet/type/trove_api_paste_ini.rb +++ b/lib/puppet/type/trove_api_paste_ini.rb @@ -45,4 +45,7 @@ Puppet::Type.newtype(:trove_api_paste_ini) do defaultto('') end + autorequire(:package) do + 'trove-api' + end end diff --git a/lib/puppet/type/trove_conductor_config.rb b/lib/puppet/type/trove_conductor_config.rb index b790a3b1..d5ab3426 100644 --- a/lib/puppet/type/trove_conductor_config.rb +++ b/lib/puppet/type/trove_conductor_config.rb @@ -46,4 +46,7 @@ Puppet::Type.newtype(:trove_conductor_config) do defaultto('') end + autorequire(:package) do + 'trove-conductor' + end end diff --git a/lib/puppet/type/trove_config.rb b/lib/puppet/type/trove_config.rb index b3bcce4a..81491ebe 100644 --- a/lib/puppet/type/trove_config.rb +++ b/lib/puppet/type/trove_config.rb @@ -46,4 +46,7 @@ Puppet::Type.newtype(:trove_config) do defaultto('') end + autorequire(:package) do + 'trove-api' + end end diff --git a/lib/puppet/type/trove_guestagent_config.rb b/lib/puppet/type/trove_guestagent_config.rb index dff561e6..a15e17dc 100644 --- a/lib/puppet/type/trove_guestagent_config.rb +++ b/lib/puppet/type/trove_guestagent_config.rb @@ -46,4 +46,7 @@ Puppet::Type.newtype(:trove_guestagent_config) do defaultto('') end + autorequire(:package) do + 'trove-guestagent' + end end diff --git a/manifests/api.pp b/manifests/api.pp index 9333283a..a76dc957 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -177,16 +177,7 @@ class trove::api( 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 { diff --git a/manifests/conductor.pp b/manifests/conductor.pp index 0d3b5ade..93f034d6 100644 --- a/manifests/conductor.pp +++ b/manifests/conductor.pp @@ -68,14 +68,6 @@ class trove::conductor( 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+/) { diff --git a/manifests/db/sync.pp b/manifests/db/sync.pp index 97d69dbf..9d3f947e 100644 --- a/manifests/db/sync.pp +++ b/manifests/db/sync.pp @@ -23,6 +23,5 @@ class trove::db::sync { user => 'trove', refreshonly => true, subscribe => Trove_config['database/connection'], - require => Package['trove-api'], } } diff --git a/manifests/guestagent.pp b/manifests/guestagent.pp index 2d803a6a..4df82b22 100644 --- a/manifests/guestagent.pp +++ b/manifests/guestagent.pp @@ -73,14 +73,6 @@ class trove::guestagent( 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 { diff --git a/manifests/init.pp b/manifests/init.pp index 57bc4013..59739287 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -308,32 +308,9 @@ class trove( 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'] - } - } diff --git a/spec/unit/type/trove_conductor_config_spec.rb b/spec/unit/type/trove_conductor_config_spec.rb new file mode 100644 index 00000000..b63978a3 --- /dev/null +++ b/spec/unit/type/trove_conductor_config_spec.rb @@ -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 diff --git a/spec/unit/type/trove_conductor_guestagent_spec.rb b/spec/unit/type/trove_conductor_guestagent_spec.rb new file mode 100644 index 00000000..77e1ff7a --- /dev/null +++ b/spec/unit/type/trove_conductor_guestagent_spec.rb @@ -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 diff --git a/spec/unit/type/trove_config_spec.rb b/spec/unit/type/trove_config_spec.rb index 486d5176..2df28597 100644 --- a/spec/unit/type/trove_config_spec.rb +++ b/spec/unit/type/trove_config_spec.rb @@ -49,4 +49,14 @@ describe 'Puppet::Type.type(:trove_config)' do @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