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 - sos report --upload not prompting for credentials
Summary: sos report --upload not prompting for credentials
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: sos
Version: 9.1
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Pavel Moravec
QA Contact: Supportability QE
URL:
Whiteboard:
Depends On:
Blocks: 2166584 2166637
TreeView+ depends on / blocked
 
Reported: 2023-01-17 21:03 UTC by Shawn
Modified: 2023-03-16 21:43 UTC (History)
5 users (show)

Fixed In Version: sos-4.5.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2166584 2166637 (view as bug list)
Environment:
Last Closed: 2023-03-16 21:43:34 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github sosreport sos pull 3117 0 None open [policies] set case_id before prompting for upload credentials 2023-01-19 08:16:41 UTC
Red Hat Issue Tracker RHELPLAN-145418 0 None None None 2023-01-17 21:04:48 UTC

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.


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