Bug 1375706

Summary: Puppet hosts in satellite web UI are incorrectly registered as FQDN
Product: Red Hat Satellite Reporter: Stephen Beal <sbeal>
Component: Hosts - ContentAssignee: Partha Aji <paji>
Status: CLOSED ERRATA QA Contact: Jan Hutaƙ <jhutar>
Severity: high Docs Contact:
Priority: medium    
Version: 6.2.0CC: alex, bbuckingham, bkearney, cmarinea, egolov, ehelms, inecas, jcallaha, jhutar, jsherril, mmello, ohadlevy, paji, ralford, rjerrido, tbhowmik, vgunasek, yundtj
Target Milestone: 6.4.0Keywords: Reopened, Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-katello-3.0.0.100-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1418822 (view as bug list) Environment:
Last Closed: 2018-10-16 18:52:45 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: 1411935, 1418822    
Attachments:
Description Flags
Duplicite records when registering with subscription-manager and puppet agent none

Description Stephen Beal 2016-09-13 19:32:55 UTC
Description of problem:

When registering a Content host with Katello, we are able to successfully register a host using the short hostname. WHen trying to register the same host with puppet, using this command:

puppet agent -t --server xxxxxxxx.xxx.xxxx.xxx --certname `hostname -s`

Puppet correctly identifies this host as a short hostname when generating the SSL certificate, however the web UI, creates a new host, one for the content host (short) and one for the puppet (FQDN). Below is the output of our registration command:

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

Satellite 6.2


Actual results:

web UI shows host for content host with shortname, and one for puppet with fqdn.


Expected results:

Consistently shows hostname used for registration (in this case, short)


Additional info:

  Based on our investigation, the Ruby template file  is displaying the column name from the PostgreSQL database named foreman/hosts. 
  
    =============
    /usr/share/foreman/app/views/hosts/_list.html.erb
 
            <% hosts.each do |host| %>
      <tr>
        <td class="ca">
          <%= check_box_tag "host_ids[]", nil, false, :id => "host_ids_#{host.id}", :class => 'host_select_boxes', :onclick => 'hostChecked(this)' %>
        </td>
        <td class="ellipsis"><%= name_column(host) %>    <---- here
        </td>
        <td class="hidden-xs ellipsis"><%= (icon(host.operatingsystem, :size => "16x16") + " #{host.operatingsystem.to_label}").html_safe if host.operatingsystem %></td>
        <td class="hidden-xs ellipsis"><%= host.environment %></td>
        <td class="hidden-tablet hidden-xs ellipsis"><%= model_name host %></td>
        <td class="hidden-tablet hidden-xs"><%= label_with_link host.hostgroup, 23, @hostgroup_authorizer %></td>
        <td class="hidden-tablet hidden-xs ellipsis"><%= last_report_column(host) %></td>
    =============

  Satellite is creating the certname correct as we can see on the SQL output you provided this afternoon, however it is not the column being displayed by the webUI which may be creating the confusing. During our tests, if we rename the value on the field "name" to match with the certname the short name is displayed, however, this was just a troubleshooting step and should not be used for now. 
  
    ==============
      
      foreman=# select id, name, certname from hosts;
         id |           name           |       certname        
        ----+--------------------------+-----------------------
          9 | xxxx13.xxx.xxxx.xxx    | 
         32 | xxxx6505.xxx.xxxx.xxx | 
         53 | xxx01.xxxx.xxxx.xxx    | 
         39 | xxlab10                  | 
         16 | xxxlab65                | 
         38 | xxxlab6507              | 
         33 | xxxlab6505              | 
         42 | xxxlab6508              | 
          5 | xxxxxx12                 | 
         37 | xxxxlab67                | 
         18 | xxxxlab6502              | 
         52 | xxxx01                  | xxxx01
         19 | xxxxlab6503              | 
         12 | xxxxx12.xxx.xxxx.xxx    | xxxxxx.xxx.xxxx.xxx
         60 | xxxxlabsat5.xxx.xxxx.xxx | xxxxlabsat5
         58 | xxxxlab01                | 
         59 | xxxxlab01.xxx.xxxx.xxx   | xxxxlab01
        (17 rows)

      foreman# update hosts set name = 'xxxxab01' where id = 59;
      foreman# commit;
      
        --- the troubleshooting step above changed the display to shortname
    ==============

    Since for a provisioning on Satellite is requires a domain it seems that is the reason of why the FQDN is being used instead the short name. Satellite (using the Foreman capabilities) requires a domain and subnet so then it assumes the FQDN. 
    
    Since you want to use short names, as defined by the Puppet certificate (CN=shortname), we will follow-up with engineering if is the situation to an RFE to use short names instead. 
    
    As you already mentioned in the case, if you override the FQDN Puppet fact via /etc/facter/facts.d you can workaround it. 

After some additional review of this, overriding the facter fact "fqdn" will _not_ be a viable workaround.  If we do this, we will lose access to that "fact" (fqdn) should we need to use it in future puppet modules.

Comment 8 Ohad Levy 2016-09-15 12:45:18 UTC

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

Comment 11 Bryan Kearney 2016-12-14 20:51:10 UTC
Connecting redmine issue http://projects.theforeman.org/issues/17102 from this bug

Comment 12 Bryan Kearney 2016-12-14 21:00:33 UTC
Upstream bug component is Infrastructure

Comment 13 Bryan Kearney 2016-12-14 21:00:36 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/17102 has been resolved.

Comment 16 jcallaha 2017-03-02 15:16:15 UTC
Failed QA in Satellite 6.2.8 Snap 4. Based on conversations with justin and rich, we have determined that the required patches developed to address this issue are not aligned to this bug.

Comment 21 Satellite Program 2017-03-02 19:00:34 UTC
Upstream bug assigned to paji

Comment 22 Satellite Program 2017-03-02 19:00:42 UTC
Upstream bug assigned to paji

Comment 24 Satellite Program 2018-01-18 17:00:41 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/17521 has been resolved.

Comment 25 Ivan Necas 2018-07-18 08:29:43 UTC
Failed QE in sat 6.4 snap 12, steps:

1. setting 'Append domain names to the host' to No
2. subscription-manager register --username admin --password changeme --name $(hostname -s)
3. puppet agent -t --certname `hostname -s`
4. two hosts were created, one belonging to the organization, the other one not

Another observation I had was, that even when supplying other --name and certname (such as sat-6-4-qa-rhel7-1), the host was still registered just as short name (sat-6-4-qa-rhel7).

Comment 26 Ivan Necas 2018-07-18 08:30:33 UTC
Created attachment 1459672 [details]
Duplicite records when registering with subscription-manager and puppet agent

Comment 27 Ivan Necas 2018-07-18 08:35:58 UTC
With 'Append domain names to the host' set to yes (default), the host registers as full fqdn and matching the content host and puppet host works properly.

Comment 29 Satellite Program 2018-07-18 10:00:45 UTC
Upstream bug assigned to paji

Comment 40 Bryan Kearney 2018-10-16 18:52:45 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:2927