Skip to content

Commit

Permalink
Refs #37825 - Use #add instead of #<< for ActiveModel::Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ofedoren committed Nov 4, 2024
1 parent 5c279d2 commit 2f040d6
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/controllers/usergroups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions app/models/compute_resources/foreman/model/ec2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/models/compute_resources/foreman/model/libvirt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {})
Expand Down
2 changes: 1 addition & 1 deletion app/models/compute_resources/foreman/model/openstack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/models/compute_resources/foreman/model/vmware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2f040d6

Please sign in to comment.