#1164 Don't allow building modules with the same name as a base module (e.g. platform)
Merged 5 years ago by fivaldi. Opened 5 years ago by mprahl.

@@ -568,6 +568,10 @@ 

      """

      import koji  # Placed here to avoid py2/py3 conflicts...

  

+     if mmd.get_name() in conf.base_module_names:

+         raise ValidationError(

+             'You cannot build a module named "{}" since it is a base module'.format(mmd.get_name()))

+ 

      raise_if_stream_ambigous = False

      default_streams = {}

      if optional_params:

@@ -1309,6 +1309,26 @@ 

          }

          assert rv.status_code == 400

  

+     @patch('module_build_service.auth.get_user', return_value=user)

+     @patch('module_build_service.scm.SCM')

+     def test_submit_build_with_base_module_name(self, mocked_scm, mocked_get_user):

+         FakeSCM(mocked_scm, 'platform', 'testmodule.yaml',

+                 '620ec77321b2ea7b0d67d82992dda3e1d67055b4')

+ 

+         data = {

+             'branch': 'master',

+             'scmurl': 'https://src.stg.fedoraproject.org/modules/'

+                       'platform.git?#68931c90de214d9d13feefbd35246a81b6cb8d49',

+         }

+         rv = self.client.post('/module-build-service/1/module-builds/', data=json.dumps(data))

+         result = json.loads(rv.data)

+         assert result == {

+             'error': 'Bad Request',

+             'status': 400,

+             'message': 'You cannot build a module named "platform" since it is a base module'

+         }

+         assert rv.status_code == 400

+ 

      @pytest.mark.parametrize('dep_type', ('buildrequire', 'require'))

      @patch('module_build_service.auth.get_user', return_value=user)

      @patch('module_build_service.scm.SCM')

A user managed to build a module called "platform", which stopped dependency resolution from working. This should stop that from happening again.

rebased onto b570948

5 years ago

Pull-Request has been merged by fivaldi

5 years ago

But what if I want to provide my own "platform" stream?!