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 2155444 - Registration command should not fail with status 0
Summary: Registration command should not fail with status 0
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Registration
Version: 6.11.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: 6.15.0
Assignee: satellite6-bugs
QA Contact: Shweta Singh
Zuzana Lena Ansorgova
URL:
Whiteboard:
: 2174022 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-12-21 09:29 UTC by vivek singh
Modified: 2024-04-23 17:13 UTC (History)
6 users (show)

Fixed In Version: foreman-3.9.1.3-1
Doc Type: Bug Fix
Doc Text:
.Registration exit code reflects registration failure Previously, the registration command returned the 0 exit code even when host registration failed. With this release, the registration command returns 0 only when it succeeds and non-zero codes otherwise.
Clone Of:
Environment:
Last Closed: 2024-04-23 17:13:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36969 0 High New Registration command should not fail with status 0 2023-12-07 16:36:45 UTC
Red Hat Issue Tracker SAT-18114 0 None None None 2023-06-05 14:42:52 UTC
Red Hat Issue Tracker SAT-19562 0 None None None 2023-09-01 12:36:58 UTC
Red Hat Product Errata RHSA-2024:2010 0 None None None 2024-04-23 17:13:03 UTC

Description vivek singh 2022-12-21 09:29:58 UTC
1. Proposed title of this feature request.
=> Need to verify that if the host is registered successfully using global template by using any ansible playbook or script


2. What are the nature and description of the request?  

* Customer concern is if there is problem when registering a host how would a program running the registration know, means if script is used to register host how script will know if it has fully worked or not. Is there any exit status for it or any messages.

* Customer was trying to register client using global registration template and while executing curl command the client was registered but it failed at one point and the echo $? showed exit status as 0.

* Customer expectation is it should show 1 or any other exits status. In unix/linux, in general, if an exit status (shell variable $?) is greater than zero, it is considered an error.  In the current situation, the exit status for global registration templates, will be zero, even if registration was not successful.

* I tried to check on this and curl command gave an exit status of zero even if it failed to install the insight packages or was not able to resolve the satellite hostname.


3. Why do you need this? (List the business requirements here).
Need to verify that if the host is registered successfully using global template by using any ansible playbook or script
 
4. How would you like to achieve this? (List the functional requirements here).
If Script runs to register and if at any step it fails then echo $? should return non zero value instead of zero based on last run step. 

5. For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented. 
We will try to register host using global registration template and try to fail it intentionaly at one step then check echo $? output. 
  
6. Do you have any specific timeline dependencies and which release would they like to target (i.e. Satellite 6.8,7)?
NA
     
7. List any affected packages or components. 
NA 
      
8. Would you be able to assist in testing this functionality if implemented?  
Yes

Comment 2 Leos Stejskal 2023-01-10 10:05:33 UTC
Hi,
I believe this is a valid issue,
registration command should exit with proper status when it fails for any reason.

Comment 5 Marek Hulan 2023-06-05 14:40:49 UTC
*** Bug 2174022 has been marked as a duplicate of this bug. ***

Comment 8 Brad Buckingham 2023-10-30 11:29:29 UTC
Bulk setting Target Milestone = 6.15.0 where sat-6.15.0+ is set.

Comment 9 nalfassi 2023-12-07 16:36:43 UTC
Created redmine issue https://projects.theforeman.org/issues/36969 from this bug

Comment 10 Bryan Kearney 2024-01-15 12:02:14 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36969 has been resolved.

Comment 12 Shweta Singh 2024-01-23 10:37:41 UTC
Verified.

Version Tested: 
1. Generate a curl command and make the registration fail intentionally.
2. Check the exit code for the command.

Observation:
Exit code returns 1 if registration fails and returns 0 otherwise.

Comment 14 George R 2024-03-19 06:33:51 UTC
Question: about "Exit code returns 1 if registration fails and returns 0 otherwise."  Is "registration" the entire process or just subscription-manager register?  If `subscription-manager subscribe` is successful, but another part of the process fails (for example, insights), what will be the exit status?  The expectation is unless all parts of the registration work, the exit status would be non-zero.  If all parts work, then exit status should be 0.

Comment 20 errata-xmlrpc 2024-04-23 17:13:01 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 (Important: Satellite 6.15.0 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-2024:2010


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