diff -Nru sosreport-4.1/debian/changelog sosreport-4.1/debian/changelog --- sosreport-4.1/debian/changelog 2021-03-25 19:02:37.000000000 +0000 +++ sosreport-4.1/debian/changelog 2021-05-13 14:22:56.000000000 +0000 @@ -1,3 +1,11 @@ +sosreport (4.1-1ubuntu0.20.04.2) focal; urgency=medium + + * d/p/0003-ubuntu-policy-fix-upload.patch: + - Fix sos archive upload to UA Canonical server + (LP: #1923209) + + -- Eric Desrochers Thu, 13 May 2021 10:22:56 -0400 + sosreport (4.1-1ubuntu0.20.04.1) focal; urgency=medium * New 4.1 upstream minor release. (LP: #1917894) diff -Nru sosreport-4.1/debian/patches/0003-ubuntu-policy-fix-upload.patch sosreport-4.1/debian/patches/0003-ubuntu-policy-fix-upload.patch --- sosreport-4.1/debian/patches/0003-ubuntu-policy-fix-upload.patch 1970-01-01 00:00:00.000000000 +0000 +++ sosreport-4.1/debian/patches/0003-ubuntu-policy-fix-upload.patch 2021-05-13 14:22:51.000000000 +0000 @@ -0,0 +1,75 @@ +From 3c90f654dc10c107003d6061ce6346c191269a87 Mon Sep 17 00:00:00 2001 +From: Jake Hunsaker +Date: Fri, 9 Apr 2021 11:05:47 -0400 +Subject: [PATCH] [ubuntu|Policy] Fix exception when attempting upload + +Fixes an issue where an upload attempt on Ubuntu systems would fail with +a traceback due to the upload archive's name not being available when we +first check to make sure we have an upload location, since the Ubuntu +default location requires an archive/file name. + +Related to this, stop clobbering `upload_archive` and assign the archive +name to an `upload_archive_name` variable instead. + +Closes: #2472 +Resolves: #2479 + +Signed-off-by: Jake Hunsaker +--- + sos/policies/distros/__init__.py | 9 +++++---- + sos/policies/distros/ubuntu.py | 4 +++- + 2 files changed, 8 insertions(+), 5 deletions(-) + +--- a/sos/policies/distros/__init__.py ++++ b/sos/policies/distros/__init__.py +@@ -149,6 +149,7 @@ + self.upload_user = cmdline_opts.upload_user + self.upload_directory = cmdline_opts.upload_directory + self.upload_password = cmdline_opts.upload_pass ++ self.upload_archive_name = '' + + if not cmdline_opts.batch and not \ + cmdline_opts.quiet: +@@ -237,7 +238,7 @@ + `get_upload_url_string()` + Print a more human-friendly string than vendor URLs + """ +- self.upload_archive = archive ++ self.upload_archive_name = archive + if not self.upload_url: + self.upload_url = self.get_upload_url() + if not self.upload_url: +@@ -384,7 +385,7 @@ + raise Exception("Unable to upload due to missing python requests " + "library") + +- with open(self.upload_archive, 'rb') as arc: ++ with open(self.upload_archive_name, 'rb') as arc: + if not self._use_https_streaming: + r = self._upload_https_no_stream(arc) + else: +@@ -467,9 +468,9 @@ + % str(err)) + + try: +- with open(self.upload_archive, 'rb') as _arcfile: ++ with open(self.upload_archive_name, 'rb') as _arcfile: + session.storbinary( +- "STOR %s" % self.upload_archive.split('/')[-1], ++ "STOR %s" % self.upload_archive_name.split('/')[-1], + _arcfile + ) + session.quit() +--- a/sos/policies/distros/ubuntu.py ++++ b/sos/policies/distros/ubuntu.py +@@ -74,7 +74,9 @@ + + def get_upload_url(self): + if not self.upload_url or self.upload_url.startswith(self._upload_url): +- fname = os.path.basename(self.upload_archive) ++ if not self.upload_archive_name: ++ return self._upload_url ++ fname = os.path.basename(self.upload_archive_name) + return self._upload_url + fname + super(UbuntuPolicy, self).get_upload_url() + diff -Nru sosreport-4.1/debian/patches/series sosreport-4.1/debian/patches/series --- sosreport-4.1/debian/patches/series 2021-03-22 12:18:08.000000000 +0000 +++ sosreport-4.1/debian/patches/series 2021-05-13 14:22:51.000000000 +0000 @@ -1,2 +1,3 @@ 0002-clean-prevent-parsing-ubuntu-user.patch 0001-debian-change-tmp-dir-location.patch +0003-ubuntu-policy-fix-upload.patch