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

Add the provider region to the replication subscription array data #11990

Merged
Merged
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
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