#203 Couple of modularity fixes
Merged 6 years ago by frostyx. Opened 6 years ago by frostyx.
copr/ frostyx/copr modularity-fixes  into  master

@@ -196,7 +196,7 @@ 

  

          # Module repository should be allowed via DNF, but the code isn't merged yet

          # https://github.com/rpm-software-management/dnf-plugins-core/pull/214

-         rlRun "curl $FRONTEND_URL/coprs/$USER/module-testmodule-beakertest-$DATE/module_repo/fedora-rawhide/testmodule-beakertest-$DATE > /etc/yum.repos.d/testmodule.repo"

+         rlRun "curl $FRONTEND_URL/coprs/$USER/module-testmodule-beakertest-$DATE/module_repo/fedora-rawhide/testmodule-beakertest-$DATE.repo > /etc/yum.repos.d/testmodule.repo"

  

          rlAssertEquals "Module should be visible in the system" `dnf module list |grep testmodule |grep beakertest |grep $DATE |grep -v "Copr modules repo" |wc -l` 1

          rlRun "dnf module enable testmodule:beakertest"

@@ -7,6 +7,7 @@ 

  import sqlalchemy

  import json

  import requests

+ from requests.exceptions import RequestException, InvalidSchema

  from wtforms import ValidationError

  

  from werkzeug import secure_filename
@@ -1010,11 +1011,8 @@ 

              "message": "Created module {}".format(module.nsv),

          })

  

-     except ValidationError as ex:

-         raise LegacyApiError(ex.message)

- 

-     except requests.RequestException as ex:

-         raise LegacyApiError(ex.message)

+     except (ValidationError, RequestException, InvalidSchema) as ex:

+         raise LegacyApiError(str(ex))

  

      except sqlalchemy.exc.IntegrityError:

          raise LegacyApiError("Module {}-{}-{} already exists".format(

@@ -820,8 +820,8 @@ 

  ###                Module repo files                  ###

  #########################################################

  

- @coprs_ns.route("/<username>/<coprname>/module_repo/<name_release>/<module_nsv>")

- @coprs_ns.route("/g/<group_name>/<coprname>/module_repo/<name_release>/<module_nsv>")

+ @coprs_ns.route("/<username>/<coprname>/module_repo/<name_release>/<module_nsv>.repo")

+ @coprs_ns.route("/g/<group_name>/<coprname>/module_repo/<name_release>/<module_nsv>.repo")

  @req_with_copr

  def generate_module_repo_file(copr, name_release, module_nsv):

      """ Generate module repo file for a given project. """

Two little fixes in this PR

  • Catching the InvalidSchema schema exception when submitting module build via --url
  • Having the .repo in module repofile URL, so you can easily wget it without specifying the filename

Ouk, thank you for review. I am going to merge it.

Pull-Request has been merged by frostyx

6 years ago