Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 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 "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". 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 "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-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 2161778

Summary: sos report --upload not prompting for credentials
Product: Red Hat Enterprise Linux 9 Reporter: Shawn <sbrockme>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED CURRENTRELEASE QA Contact: Supportability QE <supportability-qe>
Severity: low Docs Contact:
Priority: low    
Version: 9.1CC: agk, jcastillo, plambri, sbradley, theute
Target Milestone: rcKeywords: Regression, Triaged, ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sos-4.5.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2166584 2166637 (view as bug list) Environment:
Last Closed: 2023-03-16 21:43:34 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: 2166584, 2166637    

Comment 1 Pavel Moravec 2023-01-18 13:36:31 UTC
This happens to any sos-4.* version I tried:

# sos report -o qpid --upload --case-id 02732787
..
..
Your sosreport has been generated and saved in:
	/var/tmp/sosreport-pmoravec-rhel8-02732787-2023-01-18-wwyaytq.tar.xz

 Size	4.10KiB
 Owner	root
 sha256	7176170d965de5c3192b3f13ba55c1bfb4da215d4cebed9a8281c956e07bb108

Please send this file to your support representative.

Attempting upload to Red Hat Customer Portal
Upload to Red Hat Customer Portal failed. Trying sftp://sftp.access.redhat.com
Attempting upload to Red Hat Secure FTP
User 'OBFUSCATED'used for anonymous upload. Please inform your support engineer so they may retrieve the data.
Uploaded archive successfully
#


Here, sos in interactive mode (no --batch option used) properly attempts to upload the tarball to Red Hat Customer Portal, BUT forgets to ask for credentials. Empty credentials dont work, so it fails over to SFTP - where again no credentials are silently assumed.

So, the fix should be "when not using batch mode, and when credentials are not set, query for them before any upload".


I am going to check the code for this.

Comment 2 Pavel Moravec 2023-01-18 22:20:11 UTC
I think this should be a fix:

--- a/sos/policies/distros/__init__.py
+++ b/sos/policies/distros/__init__.py
@@ -296,6 +296,15 @@ class LinuxPolicy(Policy):
                         _("Optionally, please enter the case id that you are "
                           "generating this report for [%s]: ") % caseid
                     )
+            except KeyboardInterrupt:
+                self._print()
+                raise
+        if cmdline_opts.case_id:
+            self.case_id = cmdline_opts.case_id
+
+        if not cmdline_opts.batch and not \
+                cmdline_opts.quiet:
+            try:
                 # Policies will need to handle the prompts for user information
                 if cmdline_opts.upload and self.get_upload_url():
                     self.prompt_for_upload_user()
@@ -305,9 +314,6 @@ class LinuxPolicy(Policy):
                 self._print()
                 raise
 
-        if cmdline_opts.case_id:
-            self.case_id = cmdline_opts.case_id
-
         return
 
     def prompt_for_upload_user(self):


As this causes https://github.com/sosreport/sos/blob/main/sos/policies/distros/redhat.py#L269 will be properly evaluated with self.case_id filled.

I will review it tomorrow..

Comment 3 Pavel Moravec 2023-02-02 08:34:10 UTC
Completely fixed in current sos-4.5.0 upstream release.

Comment 7 Pavel Moravec 2023-03-16 21:43:34 UTC
Closing the bugzilla as the fix has been delivered in sos-4.5.0-1.el9 released via https://access.redhat.com/errata/RHBA-2023:1301 errata.