#430 Fix default SSH upload target
Merged 2 years ago by ngompa. Opened 2 years ago by qulogic.
qulogic/FedoraReview fix-upload-target  into  master

@@ -132,7 +132,7 @@ 

      """ gitsync Settings """

  

      # upload target

-     upload_target = "@username@.fedorapeople.org:public_html/"

+     upload_target = "fedorapeople.org:public_html/"

      # bugzilla settings

      bugzilla_api_key = ""

      bugzilla_username = ""
@@ -287,30 +287,36 @@ 

          else:

              raise FedoraCreateReviewError("Failed to acquire a valid Kerberos ticket")

  

-     def upload_target(self):

-         """ Get the upload target from settings and fill in the placeholders

-         if needed.

-         """

-         target = self.settings.upload_target

-         # ensure we're always setting the right fedorapeople URL

-         if target.startswith("fedorapeople.org:"):

-             target = target.replace("fedorapeople.org:", "@username@.fedorapeople.org:")

-         # fill in placeholders

-         if self.USERNAME_PLACEHOLDER in target:

-             target = target.replace(self.USERNAME_PLACEHOLDER, self.username)

-         if self.PKGNAME_PLACEHOLDER in target:

+     def _expand_placeholders(self, uri):

+         """Fill in placeholders."""

+         if self.USERNAME_PLACEHOLDER in uri:

+             uri = uri.replace(self.USERNAME_PLACEHOLDER, self.username)

+         if self.PKGNAME_PLACEHOLDER in uri:

              package_name = self.retrieve_name()

-             target = target.replace(self.PKGNAME_PLACEHOLDER, package_name)

-         if not target.endswith("/"):

-             target = "{}/".format(target)

+             uri = uri.replace(self.PKGNAME_PLACEHOLDER, package_name)

+         if not uri.endswith("/"):

+             uri += "/"

+         return uri

  

-         return target

+     def upload_target(self):

+         """

+         Get the upload target from settings and fill in any placeholders.

+         """

+         return self._expand_placeholders(self.settings.upload_target)

  

      def fill_urls(self):

-         """ Fill the spec and src.rpm urls into the info table using the

+         """

+         Fill the spec and src.rpm urls into the info table using the

          info in the settings.

          """

-         url = "https://{}".format(self.upload_target().replace(":public_html", ""))

+         target = self.settings.upload_target

+         # Ensure we're always setting the right fedorapeople URL

+         if target.startswith("fedorapeople.org:"):

+             target = target.replace("fedorapeople.org:",

+                                     "@username@.fedorapeople.org:")

+         target = self._expand_placeholders(target)

+ 

+         url = "https://{}".format(target.replace(":public_html", ""))

          self.info["specurl"] = url + os.path.basename(self.specfile)

          self.info["srpmurl"] = url + os.path.basename(self.srpmfile)

  

The <user>.fedorapeople.org URL is not in the SSHFP records, and so does not always have an available fingerprint. And RelEng says to upload to fedorapeople.org directly.

Fixes #428
Fixes rhbz#2009074

rebased onto 57a5372

2 years ago

Pull-Request has been merged by ngompa

2 years ago
Metadata