Skip to content

Commit

Permalink
Add the provider region to the replication subscription array data
Browse files Browse the repository at this point in the history
Not having this data was preventing all of the central administration
authentication feature from working.
  • Loading branch information
carbonin committed Oct 17, 2016
1 parent 22d853d commit ee0f8f5
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions app/controllers/ops_controller/settings/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,11 @@ def pglogical_subscriptions_form_fields
subscriptions = get_subscriptions_array(subscriptions) unless subscriptions.empty?
if replication_type == :global
subscriptions.each do |h|
region = MiqRegion.find_by( :region => h['provider_region'])
remote_ws_address = region ? region.remote_ws_address : ''
h.merge!(:auth_key_configured => !!(region && region.auth_key_configured?), :remote_ws_address => remote_ws_address)
region = MiqRegion.find_by(:region => h[:provider_region])
h.merge!(
:auth_key_configured => !!region.try(:auth_key_configured?),
:remote_ws_address => region.try(:remote_ws_address).to_s
)
end
end

Expand Down Expand Up @@ -296,15 +298,17 @@ def params_for_connection_validation(subscription_params)
end

def get_subscriptions_array(subscriptions)
subscriptions.collect { |sub|
{:dbname => sub.dbname,
:host => sub.host,
:id => sub.id,
:user => sub.user,
:password => '●●●●●●●●',
:port => sub.port
subscriptions.collect do |sub|
{
:dbname => sub.dbname,
:host => sub.host,
:id => sub.id,
:user => sub.user,
:password => '●●●●●●●●',
:port => sub.port,
:provider_region => sub.provider_region
}
}
end
end

def valid_replication_type
Expand Down

0 comments on commit ee0f8f5

Please sign in to comment.