Bug 1470083

Summary: Discovery settings 'Hostname_facts' should not be allowed to set empty
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: Discovery PluginAssignee: Rahul Bajaj <rabajaj>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: akjha, aruzicka, lzap, rabajaj, swadeley
Target Milestone: 6.9.0Keywords: Reopened, 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: 2021-04-21 13:11:19 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:
Attachments:
Description Flags
error on discovered host console when both values set to "empty" none

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