Bug 1367944

Summary: update_subscription_facet_backend_data fails with virt-who host with hostname ending in period '.'
Product: Red Hat Satellite Reporter: Justin Sherrill <jsherril>
Component: UpgradesAssignee: orabin
Status: CLOSED ERRATA QA Contact: Jitendra Yejare <jyejare>
Severity: high Docs Contact:
Priority: high    
Version: 6.2.0CC: bbuckingham, jcallaha, jyejare
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:54:37 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:

Description Justin Sherrill 2016-08-18 00:05:10 UTC
Description of problem:

When upgrading to 6.2, the upgrade will fail/error if any of your virt-who hosts have a name that ends in a period.  

This is made more common by the fact that virt-who will upload 'hostname.' if domain is blank

Version-Release number of selected component (if applicable):
6.2.1

How reproducible:
always

Comment 2 Justin Sherrill 2016-08-18 12:42:11 UTC
Traceback:

ActiveRecord::RecordInvalid: Validation failed: Name is invalid
/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'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:208:in `transaction'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:326:in `with_transaction_returning_status'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:273:in `save!'
/usr/share/foreman/app/models/host/base.rb:199:in `set_interfaces'
/usr/share/foreman/app/models/host/base.rb:179:in `populate_fields_from_facts'
/usr/share/foreman/app/models/host/managed.rb:474:in `populate_fields_from_facts'
/usr/share/foreman/app/models/host/base.rb:153:in `import_facts'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.68/app/models/katello/host/subscription_facet.rb:82:in `update_facts'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.68/lib/katello/tasks/upgrades/3.0/update_subscription_facet_backend_data.rake:26:in `block (5 levels) in <top (required)>'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:52:in `block (2 levels) in find_each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:52:in `each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:52:in `block in find_each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:125:in `find_in_batches'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:51:in `find_each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/querying.rb:9:in `find_each'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.68/lib/katello/tasks/upgrades/3.0/update_subscription_facet_backend_data.rake:8:in `block (4 levels) in <top (required)>'
Tasks: TOP => katello:upgrades:3.0:update_subscription_facet_backend_data

Comment 3 orabin 2016-08-18 13:42:50 UTC
Created redmine issue http://projects.theforeman.org/issues/16169 from this bug

Comment 4 Bryan Kearney 2016-08-22 16:18:19 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/16169 has been closed

Comment 6 Jitendra Yejare 2018-01-02 17:35:02 UTC
Verified!

@ Satellite 6.3 snap 30

The virt-who hosts cannot be created with a period(.) in end. Satellite warns about 'invalid name' of virt-who host.
So verified without period(.) char in host end.

Steps:

1. virt-who hosts created on the hypervisor without period char(.) in end.
2. Upgrade Satellite from 6.2 to 6.3

Observation:

The upgrade is completed without any error

```
Upgrade Step: update_subscription_facet_backend_data (this may take a while) ...
Updating backend data for subscription facets
foreman-rake katello:upgrades:3.0:update_subscription_facet_backend_data finished successfully!
```

Comment 8 Satellite Program 2018-02-21 16:54:37 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/RHSA-2018:0336