diff --git a/db/migrate/20171011180000_move_openstack_refresher_settings.rb b/db/migrate/20171011180000_move_openstack_refresher_settings.rb new file mode 100644 index 000000000..4b5acc06d --- /dev/null +++ b/db/migrate/20171011180000_move_openstack_refresher_settings.rb @@ -0,0 +1,13 @@ +class MoveOpenstackRefresherSettings < ActiveRecord::Migration[5.0] + class SettingsChange < ActiveRecord::Base + end + + def up + say_with_time('Move Openstack provider refresher settings') do + SettingsChange.where(:key => '/ems/ems_openstack/refresh/inventory_object_refresh').update(:key => '/ems/ems_refresh/openstack/inventory_object_refresh') + SettingsChange.where(:key => '/ems/ems_openstack/refresh/heat/is_global_admin').update(:key => '/ems/ems_refresh/openstack/heat/is_global_admin') + SettingsChange.where(:key => '/ems/ems_openstack/refresh/is_admin').update(:key => '/ems/ems_refresh/openstack/is_admin') + SettingsChange.where(:key => '/ems/ems_openstack/refresh/event_targeted_refresh').update(:key => '/ems/ems_refresh/openstack/allow_targeted_refresh') + end + end +end diff --git a/spec/migrations/20171011180000_move_openstack_refresher_settings.rb b/spec/migrations/20171011180000_move_openstack_refresher_settings.rb new file mode 100644 index 000000000..2c5c65708 --- /dev/null +++ b/spec/migrations/20171011180000_move_openstack_refresher_settings.rb @@ -0,0 +1,21 @@ +require_migration + +describe MoveOpenstackRefresherSettings do + let(:settings_stub) { migration_stub(:SettingsChange) } + + migration_context :up do + it 'Move Openstack provider refresher settings' do + settings_stub.create!(:key => '/ems/ems_openstack/refresh/inventory_object_refresh', :value => true) + settings_stub.create!(:key => '/ems/ems_openstack/refresh/heat/is_global_admin', :value => true) + settings_stub.create!(:key => '/ems/ems_openstack/refresh/is_admin', :value => true) + settings_stub.create!(:key => '/ems/ems_openstack/refresh/event_targeted_refresh', :value => true) + + migrate + + expect(settings_stub.where(:key => '/ems/ems_refresh/openstack/inventory_object_refresh').count).to eq(1) + expect(settings_stub.where(:key => '/ems/ems_refresh/openstack/heat/is_global_admin').count).to eq(1) + expect(settings_stub.where(:key => '/ems/ems_refresh/openstack/is_admin').count).to eq(1) + expect(settings_stub.where(:key => '/ems/ems_refresh/openstack/allow_targeted_refresh').count).to eq(1) + end + end +end