Bug 1570994

Summary: embedded ansible will not start if hostname has an underscore
Product: Red Hat CloudForms Management Engine Reporter: Jeff Warnica <jwarnica>
Component: ApplianceAssignee: Brandon Dunne <bdunne>
Status: CLOSED DUPLICATE QA Contact: Dmitry Misharov <dmisharo>
Severity: high Docs Contact:
Priority: high    
Version: 5.9.0CC: abellott, cpelland, dmisharo, obarenbo
Target Milestone: GA   
Target Release: 5.9.2   
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-04-24 15:06:54 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 Jeff Warnica 2018-04-23 22:51:11 UTC
Description of problem:

Per summary, embedded ansible will not start if the hostname of the appliance has an underscore. (or otherwise fails an apparently buggy regexp.

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

How reproducible:
Always

Steps to Reproduce:
1. set hostname to something like "cf_lab1"
2. Attempt to start embedded ansible role
3. See failures in log.

I tried with both "cf_lab1" and "cf_lab1.fake", which failed. "cflab1.fake" worked.

Log extract:

[----] I, [2018-04-23T17:42:45.722835 #16502:57f40cc]  INFO -- : MIQ(EmbeddedAnsibleWorker::Runner#setup_ansible) Finished starting embedded ansible service.
[----] E, [2018-04-23T17:42:45.734370 #16502:57f40cc] ERROR -- : [URI::InvalidComponentError]: bad component(expected host component): cf_lab1.fake  Method:[block in method_missing]
[----] E, [2018-04-23T17:42:45.734501 #16502:57f40cc] ERROR -- : /opt/rh/rh-ruby23/root/usr/share/ruby/uri/generic.rb:595:in `check_host'
/opt/rh/rh-ruby23/root/usr/share/ruby/uri/generic.rb:636:in `host='
/opt/rh/rh-ruby23/root/usr/share/ruby/uri/generic.rb:670:in `hostname='
/opt/rh/rh-ruby23/root/usr/share/ruby/uri/generic.rb:189:in `initialize'
/opt/rh/rh-ruby23/root/usr/share/ruby/uri/generic.rb:136:in `new'
/opt/rh/rh-ruby23/root/usr/share/ruby/uri/generic.rb:136:in `build'
/var/www/miq/vmdb/app/models/embedded_ansible_worker/runner.rb:69:in `provider_url'
/var/www/miq/vmdb/app/models/embedded_ansible_worker/runner.rb:44:in `update_embedded_ansible_provider'
/var/www/miq/vmdb/app/models/embedded_ansible_worker/runner.rb:13:in `do_before_work_loop'
/var/www/miq/vmdb/app/models/embedded_ansible_worker/runner.rb:5:in `prepare'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:126:in `start'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:22:in `start_worker'
/var/www/miq/vmdb/app/models/embedded_ansible_worker.rb:20:in `block in start_monitor_thread'
[----] I, [2018-04-23T17:42:46.052168 #16898:d99108]  INFO -- : MIQ(MiqReportingWorker#log_status) [Reporting Worker] Worker ID [99000000000576], PID [16898], GUID [3615f9f1-2680-47ea-aeb5-0

Comment 2 Jeff Warnica 2018-04-24 12:38:12 UTC
https://github.com/rest-client/rest-client/issues/556 may be the problem (and have a workaroud)

Comment 3 Brandon Dunne 2018-04-24 15:06:54 UTC
The issue is that underscore is not allowed in the hostname of a URI.  Hostnames can include alphanumeric characters and hyphen.  I already added a workaround for this issue in https://github.com/ManageIQ/manageiq/pull/16913 and https://bugzilla.redhat.com/show_bug.cgi?id=1537566


From RFC 3986 section 3.2.2:
https://tools.ietf.org/html/rfc3986#section-3.2.2

A registered name intended for lookup in the DNS uses the syntax defined in Section 3.5 of [RFC1034] and Section 2.1 of [RFC1123].  Such a name consists of a sequence of domain labels separated by ".", each domain label starting and ending with an alphanumeric character and possibly also containing "-" characters.

*** This bug has been marked as a duplicate of bug 1537566 ***