diff --git a/lib/miq_pglogical.rb b/lib/miq_pglogical.rb index 488892916c8..b42b8698898 100644 --- a/lib/miq_pglogical.rb +++ b/lib/miq_pglogical.rb @@ -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) diff --git a/spec/replication/util/miq_pglogical_spec.rb b/spec/replication/util/miq_pglogical_spec.rb index b041bd75797..99efcf2b12c 100644 --- a/spec/replication/util/miq_pglogical_spec.rb +++ b/spec/replication/util/miq_pglogical_spec.rb @@ -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