Create attribute for setting options passed to ceilometer-upgrade

I ran into a problem similar to this one [1] where testing gnocchi commands did
not work properly. The key problem is the fact that
`--skip-gnocchi-resource-types` was included in the ceilometer-upgrade command.
To allow an easy work around, I figure we can just create an attribute which can
add any option to ceilometer-upgrade so you can set it to '' if you don't want
it.

It might be debatable on whether to just default to run it with out
`ceilometer-upgrade` instead.

In addition, move the ceilometer-upgrade command to the common recipe where it
makes more sense since it's needed globally.

[1] https://bugs.launchpad.net/openstack-ansible/+bug/1737096

Change-Id: I619ef044b8cb254b23e0c7bc674c46d5dd7e0076
Signed-off-by: Lance Albertson <lance@osuosl.org>
This commit is contained in:
Lance Albertson 2019-10-23 12:51:56 -07:00
parent e0a39ccaf1
commit 129c68de18
5 changed files with 25 additions and 11 deletions

View File

@ -51,6 +51,7 @@ default['openstack']['telemetry_metric']['conf_dir'] = '/etc/gnocchi'
default['openstack']['telemetry_metric']['conf_file'] =
::File.join(node['openstack']['telemetry_metric']['conf_dir'], 'gnocchi.conf')
default['openstack']['telemetry']['syslog']['use'] = false
default['openstack']['telemetry']['upgrade_opts'] = '--skip-gnocchi-resource-types'
default['openstack']['aodh']['conf_dir'] = '/etc/aodh'
default['openstack']['aodh']['conf_file'] =

View File

@ -30,11 +30,6 @@ platform['collector_packages'].each do |pkg|
end
end
conf_switch = "--config-file #{node['openstack']['telemetry']['conf_file']}"
execute 'database migration' do
command "ceilometer-upgrade --skip-gnocchi-resource-types #{conf_switch}"
end
service 'ceilometer-collector' do
service_name platform['collector_service']
subscribes :restart, "template[#{node['openstack']['telemetry']['conf_file']}]"

View File

@ -103,3 +103,8 @@ template node['openstack']['telemetry']['conf_file'] do
service_config: ceilometer_conf_options
)
end
conf_switch = "--config-file #{node['openstack']['telemetry']['conf_file']}"
execute 'ceilometer database migration' do
command "ceilometer-upgrade #{node['openstack']['telemetry']['upgrade_opts']} #{conf_switch}"
end

View File

@ -15,12 +15,6 @@ describe 'openstack-telemetry::collector' do
expect(chef_run).to upgrade_package 'ceilometer-collector'
end
it do
expect(chef_run).to run_execute(
'ceilometer-upgrade --skip-gnocchi-resource-types --config-file /etc/ceilometer/ceilometer.conf'
)
end
it do
expect(chef_run).to upgrade_package('python-mysqldb')
end

View File

@ -10,6 +10,25 @@ describe 'openstack-telemetry::common' do
include_context 'telemetry-stubs'
it do
expect(chef_run).to run_execute('ceilometer database migration')
.with(
command: 'ceilometer-upgrade --skip-gnocchi-resource-types --config-file /etc/ceilometer/ceilometer.conf'
)
end
context 'Non-default upgrade_opts' do
before do
node.override['openstack']['telemetry']['upgrade_opts'] = ''
end
it do
expect(chef_run).to run_execute('ceilometer database migration')
.with(
command: 'ceilometer-upgrade --config-file /etc/ceilometer/ceilometer.conf'
)
end
end
context 'with logging enabled' do
before do
node.override['openstack']['telemetry']['syslog']['use'] = true