Project

General

Profile

Bug #26909

Unable to add smartclass parameter with matcher fqdn, when hosts installed with disabled option "add domain to hostname"

Added by Hao Yu 5 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Smart Variables
Target version:
-
Difficulty:
Triaged:
Yes
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Description of problem:
When a host is installed with name and the satellite option "append domain name for hosts" is disabled, it's not possible to define a sc-parameter using hammer, which matches on fqdn.

Version-Release number of selected component (if applicable):
tfm-rubygem-hammer_cli-0.13.1.1-1.el7sat.noarch

How reproducible:
always

Steps to Reproduce:
1. hammer settings set --name 'append_domain_name_for_hosts' --value 'false'
2. hammer host create \
--ask-root-password 0 \
--build 1 \
--provision-method build \
--domain "crazy.lab" \
--hostgroup "HG-RHEL7-DEV" \
--subnet "crazy.lab" \
--organization "CRAZY LAB" \
--location "LOCAL" \
--name "rhelhosta" \
--compute-resource "libvirt@CHUNK"

3. hammer host start --name "rhelhosta"
4. hammer sc-param add-matcher --match 'fqdn=rhelhosta.crazy.lab' --value 'Good Morning' --smart-class-parameter content --puppet-class motd

Actual results:
Could not create the override value:
Validation failed: Match fqdn=rhelhosta.crazy.lab does not match an existing host

Expected results:
A sc-parameter is added with matcher fqdn=rhelhosta.crazy.lab

Additional info:

  1. hammer fact list --search "rhelhost*"
    ----------|----------------------|--------------------
    HOST | FACT | VALUE
    ----------|----------------------|--------------------
    rhelhosta | hostname | rhelhosta
    rhelhosta | networking::hostname | rhelhosta
    rhelhosta | clientcert | rhelhosta
    rhelhosta | fqdn | rhelhosta.crazy.lab
    rhelhosta | networking::fqdn | rhelhosta.crazy.lab
    ----------|----------------------|--------------------

It's possible to add this parameter using 'hostname', but this results in not working puppet-rule, as fqdn=rhelhosta does not match facter-result.

  1. hammer sc-param add-matcher --match 'fqdn=rhelhosta' --value 'Good Morning!' --smart-class-parameter content --puppet-class motd
    Override value created.

Associated revisions

Revision 4bfee78b (diff)
Added by Hao Yu 3 months ago

Fixes #26909 - Validate fqdn matcher by hosts' primary nic name

When "Append domain names to the host" setting is set to "No",
Foreman won't append the domain name to the host after
provisioning so host.name will remain as short name. Without
this patch, user cannot create/update a lookup value with
matcher fqdn=host.domain.com because it will fail with
validation error. The reason that it failed to validate is
Foreman uses the host.name(shortname) to find for existing host
that matches "host.domain.com" which will never match.
This patch fixed the issue.

History

#1 Updated by The Foreman Bot 4 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6830 added

#2 Updated by Ondřej Ezr 3 months ago

  • Triaged changed from No to Yes
  • Category set to Smart Variables
  • Fixed in Releases 1.23.0 added

#3 Updated by Hao Yu 3 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF