Bug 1327576

Summary: Error on updating puppet facts of an unmanaged host raises: ActiveRecord::RecordInvalid: Validation failed: Fact name has already been taken
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: ProvisioningAssignee: Marek Hulan <mhulan>
Status: CLOSED ERRATA QA Contact: Sachin Ghai <sghai>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, inecas, jhutar, mhulan
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/13819
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:25:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1268207, 1276271    

Description Sachin Ghai 2016-04-15 12:41:04 UTC
Description of problem:
I registered a host with satellite6.2 via puppet and later I tried to update facts, but when I ran "puppet agent -t" on host, following exception raised on host:

2016-04-15 07:58:45 [app] [I] Started GET "/node/cloud-qe-19.idmqe.lab.eng.bos.redhat.com?format=yml" for 10.16.96.112 at 2016-04-15 07:58:45 -0400
2016-04-15 07:58:45 [app] [I] Processing by HostsController#externalNodes as YML
2016-04-15 07:58:45 [app] [I]   Parameters: {"name"=>"cloud-qe-19.idmqe.lab.eng.bos.redhat.com"}
2016-04-15 07:58:45 [app] [I]   Rendered text template (0.0ms)
2016-04-15 07:58:45 [app] [I] Completed 200 OK in 178ms (Views: 0.4ms | ActiveRecord: 7.0ms)
2016-04-15 07:58:46 [app] [I] Started POST "/api/hosts/facts" for 10.16.96.112 at 2016-04-15 07:58:46 -0400
2016-04-15 07:58:46 [app] [I] Processing by Api::V2::HostsController#facts as JSON
2016-04-15 07:58:46 [app] [I]   Parameters: {"facts"=>"[FILTERED]", "name"=>"cloud-qe-19.idmqe.lab.eng.bos.redhat.com", "certname"=>"cloud-qe-19.idmqe.lab.eng.bos.redhat.com", "apiv"=>"v2", :host=>{"name"=>"cloud-qe-19.idmqe.lab.eng.bos.redhat.com", "certname"=>"cloud-qe-19.idmqe.lab.eng.bos.redhat.com"}}
2016-04-15 07:58:46 [app] [W] Action failed
 | ActiveRecord::RecordInvalid: Validation failed: Fact name has already been taken
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/validations.rb:57:in `save!'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:273:in `block in save!'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:329:in `block in with_transaction_returning_status'
 

Version-Release number of selected component (if applicable):
sat6.2 beta snap8.1

How reproducible:


Steps to Reproduce:
1. register host via puppet
2. run puppet agent -t on host
3.

Actual results:
ActiveRecord::RecordInvalid: Validation failed: Fact name has already been taken

Expected results:
facts should be updated successfully

Additional info:
I register host via puppet and later I updated some interfaces manually on host and tan puppet agent -t to see the updated facts on webUI under host details -> NIC section but got exception mentioned in bz.

Comment 4 Marek Hulan 2016-04-21 06:50:59 UTC
This fails before we even parse the facts to create network interfaces. It seems as there are some conflicting facts of a different type, probably from a plugin (subscription manager facts?). It seems to be reported as http://projects.theforeman.org/issues/13819 already.

Comment 5 Bryan Kearney 2016-04-21 14:06:07 UTC
Upstream bug component is Provisioning

Comment 6 Sachin Ghai 2016-04-22 08:33:00 UTC
Raising the severity as its affecting verification of ON_QA bugs.

Comment 7 Bryan Kearney 2016-04-27 16:06:35 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/13819 has been closed

Comment 8 Sachin Ghai 2016-05-13 11:13:23 UTC
Verified with sat62 GA snap10.1

On updating facts of un-managed hosts, I don't see reported issue.

2016-05-13 05:34:57 [app] [I] Started POST "/api/hosts/facts" for 10.16.96.112 at 2016-05-13 05:34:57 -0400
2016-05-13 05:34:57 [app] [I] Processing by Api::V2::HostsController#facts as JSON
2016-05-13 05:34:57 [app] [I]   Parameters: {"facts"=>"[FILTERED]", "name"=>"cloud-qe-15.idmqe.lab.eng.bos.redhat.com", "certname"=>"cloud-qe-15.idmqe.lab.eng.bos.redhat.com", "apiv"=>"v2", :host=>{"name"=>"cloud-qe-15.idmqe.lab.eng.bos.redhat.com", "certname"=>"cloud-qe-15.idmqe.lab.eng.bos.redhat.com"}}
2016-05-13 05:34:58 [app] [I] Import facts for 'cloud-qe-15.idmqe.lab.eng.bos.redhat.com' completed. Added: 110, Updated: 0, Deleted 0 facts
2016-05-13 05:34:59 [app] [I] Completed 201 Created in 1525ms (Views: 5.8ms | ActiveRecord: 932.1ms)
2016-05-13 05:34:59 [app] [I] Started GET "/node/cloud-qe-15.idmqe.lab.eng.bos.redhat.com?format=yml" for 10.16.96.112 at 2016-05-13 05:34:59 -0400
2016-05-13 05:34:59 [app] [I] Processing by HostsController#externalNodes as YML
2016-05-13 05:34:59 [app] [I]   Parameters: {"name"=>"cloud-qe-15.idmqe.lab.eng.bos.redhat.com"}
2016-05-13 05:34:59 [app] [I]   Rendered text template (0.0ms)
2016-05-13 05:34:59 [app] [I] Completed 200 OK in 115ms (Views: 0.7ms | ActiveRecord: 16.4ms)
2016-05-13 05:34:59 [app] [I] Started POST "/api/reports" for 10.16.96.112 at 2016-05-13 05:34:59 -0400
2016-05-13 05:34:59 [app] [I] Processing by Api::V2::ReportsController#create as JSON
2016-05-13 05:34:59 [app] [I]   Parameters: {"report"=>"[FILTERED]", "apiv"=>"v2"}
2016-05-13 05:34:59 [app] [I] processing report for cloud-qe-15.idmqe.lab.eng.bos.redhat.com
2016-05-13 05:34:59 [app] [I] Imported report for cloud-qe-15.idmqe.lab.eng.bos.redhat.com in 0.17 seconds
2016-05-13 05:34:59 [app] [I]   Rendered api/v2/reports/create.json.rabl (21.0ms)
2016-05-13 05:34:59 [app] [I] Completed 201 Created in 283ms (Views: 28.4ms | ActiveRecord: 143.1ms)

Comment 9 Sachin Ghai 2016-05-13 11:54:32 UTC
Validated this with sat6.2 GA snap11. Issue has been fixed.

Comment 10 Bryan Kearney 2016-07-27 11:25:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1501