Skip to content

Commit

Permalink
Merge pull request #553 from agrare/subclass_cinder_manager_openstack
Browse files Browse the repository at this point in the history
Subclass CinderManagers under Openstack
  • Loading branch information
Fryguy authored Jan 21, 2021
2 parents 11b9b0b + 6b1e4dc commit 88aff12
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
12 changes: 12 additions & 0 deletions db/migrate/20210118185402_subclass_cinder_manager_openstack.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class SubclassCinderManagerOpenstack < ActiveRecord::Migration[6.0]
class ExtManagementSystem < ActiveRecord::Base
self.inheritance_column = :_type_disabled
end

def up
say_with_time("Subclass CinderManager under Openstack") do
ExtManagementSystem.where(:type => "ManageIQ::Providers::StorageManager::CinderManager")
.update_all(:type => "ManageIQ::Providers::Openstack::StorageManager::CinderManager")
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require_migration

RSpec.describe SubclassCinderManagerOpenstack do
let(:ems_stub) { migration_stub(:ExtManagementSystem) }

migration_context :up do
it "Updates the CinderManager :type" do
ems = ems_stub.create!(:type => "ManageIQ::Providers::StorageManager::CinderManager")

migrate

expect(ems.reload.type).to eq("ManageIQ::Providers::Openstack::StorageManager::CinderManager")
end

it "Doesn't update other managers' types" do
ems = ems_stub.create!(:type => "ManageIQ::Providers::Vmware::InfraManager")

migrate

expect(ems.reload.type).to eq("ManageIQ::Providers::Vmware::InfraManager")
end
end
end

0 comments on commit 88aff12

Please sign in to comment.