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

Fixed error with replication setup when default exclude list used #17999

Merged
merged 4 commits into from
Sep 20, 2018
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/miq_pglogical.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ def self.default_excludes
end

def self.save_remote_region(exclusion_list)
# part of `MiqRegion.replication_type=` is initialization of default subscription list
MiqRegion.replication_type = :remote
refresh_excludes(YAML.safe_load(exclusion_list))
# UI is passing empty 'exclution_list' if there are no changes to default subscription list
refresh_excludes(YAML.safe_load(exclusion_list)) unless exclusion_list.empty?
end

def self.save_global_region(subscriptions_to_save, subscriptions_to_remove)
Expand Down
6 changes: 6 additions & 0 deletions spec/replication/util/miq_pglogical_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@
expect(described_class).to receive(:refresh_excludes).with(YAML.safe_load(tables))
described_class.save_remote_region(tables)
end

it "does not updates list of tables to be excluded from replication if passed parameter is empty" do
allow(MiqRegion).to receive(:replication_type=)
expect(described_class).not_to receive(:refresh_excludes)
described_class.save_remote_region("")
end
end

describe ".save_global_region" do
Expand Down