Skip to content

Commit

Permalink
Move Openstack refresher settings
Browse files Browse the repository at this point in the history
  • Loading branch information
mansam committed Oct 11, 2017
1 parent 32f1506 commit 2fbcc99
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
13 changes: 13 additions & 0 deletions db/migrate/20171011180000_move_openstack_refresher_settings.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class MoveOpenstackRefresherSetttngs < 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require_migration

describe MoveOpenstackRefresherSetttngs 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

0 comments on commit 2fbcc99

Please sign in to comment.