Skip to content

Commit

Permalink
Add my_zone to Service Orchestration.
Browse files Browse the repository at this point in the history
Zone is available through the Service VMs, but is incorrect when there
are no Service VMs.

https://bugzilla.redhat.com/show_bug.cgi?id=1458011
  • Loading branch information
tinaafitz committed Jul 10, 2017
1 parent 35e4d83 commit 98922b0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app/models/service_orchestration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def post_provision_configure
assign_vms_owner
end

def my_zone
orchestration_manager.try(:my_zone) || super
end

private

def add_stack_to_resource
Expand Down
24 changes: 21 additions & 3 deletions spec/models/service_orchestration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,31 @@
end

describe "#my_zone" do
it "takes the zone from ext_management_system" do
it "deployed stack, takes the zone from ext_management_system" do
deployed_stack.ext_management_system = manager_by_setter
expect(deployed_stack.my_zone).to eq(manager_by_setter.my_zone)
end

it "returns nil if ext_management_system is not valid" do
expect(deployed_stack.my_zone).to eq(nil)
it "deployed stack, returns nil zone if ext_management_system is not valid" do
expect(deployed_stack.my_zone).to be_nil
end

it "service, takes the zone from orchestration_manager" do
ems = FactoryGirl.create(:ems_amazon, :zone => FactoryGirl.create(:zone))
deployed_stack.direct_vms << FactoryGirl.create(:vm_amazon, :ext_management_system => ems)
expect(service_with_deployed_stack.my_zone).to eq(service.orchestration_manager.my_zone)
end

it "service, takes the zone from VM ext_management_system if no orchestration_manager" do
ems = FactoryGirl.create(:ems_amazon, :zone => FactoryGirl.create(:zone))
deployed_stack.direct_vms << FactoryGirl.create(:vm_amazon, :ext_management_system => ems)
service.orchestration_manager = nil
expect(service_with_deployed_stack.my_zone).to eq(service_with_deployed_stack.vms.first.ext_management_system.my_zone)
end

it "service, returns nil zone if no orchestration_manager and no VMs" do
service.orchestration_manager = nil
expect(service_with_deployed_stack.my_zone).to be_nil
end
end

Expand Down

0 comments on commit 98922b0

Please sign in to comment.