Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1470083 - Discovery settings 'Hostname_facts' should not be allowed to set empty
Summary: Discovery settings 'Hostname_facts' should not be allowed to set empty
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Discovery Plugin
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.9.0
Assignee: Rahul Bajaj
QA Contact: Roman Plevka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-07-12 11:36 UTC by Sachin Ghai
Modified: 2021-04-21 13:11 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-04-21 13:11:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
error on discovered host console when both values set to "empty" (67.10 KB, image/png)
2017-07-12 11:36 UTC, Sachin Ghai
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 30726 0 Normal Closed Discovery settings 'Hostname_facts' should not be allowed to set empty 2021-02-11 10:34:18 UTC
Foreman Issue Tracker 30727 0 Normal Closed settings_type 'string' should not have empty value 2021-02-11 10:34:18 UTC
Github theforeman foreman pull 7934 0 None closed Fixes #30727 - Fix setting validation 2021-02-11 10:34:18 UTC
Github theforeman foreman_discovery pull 505 0 None closed Fixes #30726 - hostname prefix setting should not be nil 2021-02-11 10:34:18 UTC
Red Hat Product Errata RHSA-2021:1313 0 None None None 2021-04-21 13:11:51 UTC

Description Sachin Ghai 2017-07-12 11:36:29 UTC
Created attachment 1296908 [details]
error on discovered host console when both values set to "empty"

Description of problem:
In 6.3 snap5, we see some new discovery settings like:

hostname_facts
hostname_prefix

If we set both values to empty then discovery will fail w/ error:
Exception: Invalid_facts: hash doesn't contain valid value for any of the facts in discovery_hostname

So as per above error, user shouldn't allow to set any of the above setting as "empty", ideally, hostname_facts shouldn't set as empty. On setting it empty, user should get an error message.



Version-Release number of selected component (if applicable):
sat6.3 beta snap5

How reproducible:
always

Steps to Reproduce:
1. go to settings -> discovered
2. set empty value for both Hostname_prefix and Hostname_facts
3. 

Actual results:

as expected host discovery failed w/ error: 
Exception: Invalid_facts: hash doesn't contain valid value for any of the facts in discovery_hostname

Expected results:

User should not be allowed to change set "Hostname_facts" as empty" and error should be raised.
Additional info:

Comment 1 Sachin Ghai 2017-07-12 11:41:13 UTC
Instead of getting error after discovering the host, user should be restricted to set empty value for "hostname_facts" settings.

Comment 3 Lukas Zapletal 2017-07-12 12:44:05 UTC
Ok thanks, putting on backlog. Out of 6.3 plate.

Comment 4 Sachin Ghai 2017-08-10 10:44:41 UTC
Similar issue needs to be fixed in hammer.

]# hammer -u admin -p changeme settings set --name discovery_hostname --value ""
Setting [discovery_hostname] updated to []

Comment 5 Bryan Kearney 2018-09-04 17:46:29 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.

Comment 7 Bryan Kearney 2020-08-27 20:02:41 UTC
Upstream bug assigned to rabajaj

Comment 8 Bryan Kearney 2020-08-27 20:02:43 UTC
Upstream bug assigned to rabajaj

Comment 11 Rahul Bajaj 2021-01-25 11:07:31 UTC
Hello,

Looks like this issue is fixed upstream: https://github.com/theforeman/foreman_discovery/pull/505 

Let me know if anything else is required here.

Thank you,

Comment 12 Roman Plevka 2021-02-25 14:10:25 UTC
VERIFIED
on sat6.9.0-14.0

the aforementioned facts can't be blank now.

trying to change it via UI -> results in 422.

using CLI (API):

[root@qe-sat69-rhel7-tier3 ~]# hammer setting  set --name discovery_hostname --value ""
Could not update the setting:
  Value can't be blank
[root@qe-sat69-rhel7-tier3 ~]# hammer setting  set --name discovery_prefix --value ""
Could not update the setting:
  Value can't be blank

Comment 15 errata-xmlrpc 2021-04-21 13:11:19 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 (Moderate: Satellite 6.9 Release), 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-2021:1313


Note You need to log in before you can comment on or make changes to this bug.