Skip to content

Commit

Permalink
Merge pull request #16391 from chrisarcand/bz-1509172
Browse files Browse the repository at this point in the history
Fix Zone creation
  • Loading branch information
Fryguy authored Nov 3, 2017
2 parents 07a7684 + 4c610b2 commit f8fbc91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/vmdb/settings/database_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def self.parent_sources_for(resource)
end

def resource
@resource_instance == :my_server ? my_server : @resource_instance.reload
return my_server if @resource_instance == :my_server
@resource_instance.reload if @resource_instance.persisted?
@resource_instance
end

def load
Expand Down
5 changes: 4 additions & 1 deletion spec/lib/vmdb/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
expect(settings.api.token_ttl).to eq "3.hour"
end

it "applied settings from hierarchy Region -> Zone -> Server" do
it "applies settings from up the hierarchy: Region -> Zone -> Server" do
MiqRegion.seed

described_class.save!(server.zone.miq_region, :api => {:token_ttl => "3.hour"})
Expand All @@ -369,6 +369,9 @@
described_class.save!(server, :api => {:token_ttl => "5.hour"})
settings = Vmdb::Settings.for_resource(server)
expect(settings.api.token_ttl).to eq "5.hour"

settings = Vmdb::Settings.for_resource(MiqServer.new(:zone => server.zone))
expect(settings.api.token_ttl).to eq "4.hour"
end
end

Expand Down

0 comments on commit f8fbc91

Please sign in to comment.