diff --git a/app/controllers/usergroups_controller.rb b/app/controllers/usergroups_controller.rb index b633f906739..4079b29ffe8 100644 --- a/app/controllers/usergroups_controller.rb +++ b/app/controllers/usergroups_controller.rb @@ -37,7 +37,7 @@ def update process_error end rescue Foreman::CyclicGraphException => e - @usergroup.errors[:usergroups] << e.record.errors[:base].join(' ') + @usergroup.errors.add(:usergroups, e.record.errors[:base].join(' ')) process_error rescue => e external_usergroups_error(@usergroup, e) diff --git a/app/models/compute_resources/foreman/model/ec2.rb b/app/models/compute_resources/foreman/model/ec2.rb index 930b3316b60..d801542190a 100644 --- a/app/models/compute_resources/foreman/model/ec2.rb +++ b/app/models/compute_resources/foreman/model/ec2.rb @@ -122,9 +122,9 @@ def test_connection(options = {}) super errors[:user].empty? && errors[:password].empty? && regions rescue Fog::AWS::Compute::Error => e - errors[:base] << e.message + errors.add(:base, e.message) rescue Excon::Error::Socket => e - errors[:base] << e.message + errors.add(:base, e.message) end def console(uuid) diff --git a/app/models/compute_resources/foreman/model/libvirt.rb b/app/models/compute_resources/foreman/model/libvirt.rb index 23d367de42b..f5360fbd61f 100644 --- a/app/models/compute_resources/foreman/model/libvirt.rb +++ b/app/models/compute_resources/foreman/model/libvirt.rb @@ -78,7 +78,7 @@ def test_connection(options = {}) errors[:url].empty? && hypervisor rescue => e disconnect rescue nil - errors[:base] << e.message + errors.add(:base, e.message) end def new_nic(attr = {}) diff --git a/app/models/compute_resources/foreman/model/openstack.rb b/app/models/compute_resources/foreman/model/openstack.rb index 3a414cfa4a3..44154ace9f8 100644 --- a/app/models/compute_resources/foreman/model/openstack.rb +++ b/app/models/compute_resources/foreman/model/openstack.rb @@ -91,7 +91,7 @@ def test_connection(options = {}) super errors[:user].empty? && errors[:password] && tenants rescue => e - errors[:base] << e.message + errors.add(:base, e.message) end def available_images diff --git a/app/models/compute_resources/foreman/model/vmware.rb b/app/models/compute_resources/foreman/model/vmware.rb index 76c7ea8e9ee..1a5284f454e 100644 --- a/app/models/compute_resources/foreman/model/vmware.rb +++ b/app/models/compute_resources/foreman/model/vmware.rb @@ -470,7 +470,7 @@ def test_connection(options = {}) errors.delete(:datacenter) end rescue => e - errors[:base] << e.message + errors.add(:base, e.message) end def parse_args(args)