Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Zone creation #16391

Merged
merged 1 commit into from
Nov 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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