Actions
Bug #14689
closedActiveRecord::RecordInvalid: Validation failed: Name has already been taken
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Foreman Integration
Target version:
-
Description
Using the salt smart proxy and salt plugin, I deleted a host from Foreman, destroyed the VM, created a new VM with the same name, and tried to use "foreman-node" to update the facts for the new host. I received the error "ActiveRecord::RecordInvalid: Validation failed: Name has already been taken" in production.log when I tried to do this.
I spoke with stbenjam on IRC and he suggested I make the following change to /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_salt-5.0.0/app/services/foreman_salt/fact_importer.rb :
def fact_names
-@fact_names ||= fact_name_class.maximum(:id, :group => 'name')
+@fact_names ||= fact_name_class.group(:name).maximum(:id)
end
This seems to have fixed the problem for me.
Updated by Anonymous over 8 years ago
- Project changed from Foreman to Salt
- Category set to Foreman Integration
Updated by Marek Hulán over 8 years ago
- Related to Bug #13819: Fact imports fail with: Validation failed: Fact name has already been taken added
Updated by Markus Gebert over 8 years ago
I'm seeing this too with Foreman 1.11 and Foreman Salt 5.0.0. The fix mentioned by the OP seems to help so far.
Updated by Anonymous over 8 years ago
- Status changed from New to Closed
- Assignee set to Anonymous
done in 1ceeece560af143bb90b211ef8404c18537e3519
Updated by Stephen Benjamin over 8 years ago
- Has duplicate Bug #15129: Errors in production.log when upload-salt-reports runs - katello 3.0 RC5, Foreman 1.11.2 added
Actions