#1034 Remove PDC related configuration options
Closed 8 months ago by ralph. Opened 8 months ago by csomh.
csomh/fm-orchestrator remove-pdc-configs  into  master

file modified
-4

@@ -33,9 +33,6 @@ 

      KOJI_TAG_PREFIXES = ['module']

      KOJI_ENABLE_CONTENT_GENERATOR = True

      CHECK_FOR_EOL = False

-     PDC_URL = 'https://pdc.fedoraproject.org/rest_api/v1'

-     PDC_INSECURE = False

-     PDC_DEVELOP = True

      SCMURLS = ["git://pkgs.fedoraproject.org/modules/"]

      YAML_SUBMIT_ALLOWED = False

  

@@ -104,7 +101,6 @@ 

      SQLALCHEMY_DATABASE_URI = 'sqlite://'

      DEBUG = True

      MESSAGING = 'in_memory'

-     PDC_URL = 'https://pdc.fedoraproject.org/rest_api/v1'

  

      # Global network-related values, in seconds

      NET_TIMEOUT = 3

@@ -163,10 +163,6 @@ 

              'type': bool,

              'default': False,

              'desc': 'Flag to determine whether or not MBS should block EOL modules from building.'},

-         'pdc_url': {

-             'type': str,

-             'default': 'https://pdc.fedoraproject.org/rest_api/v1',

-             'desc': 'PDC URL, used for checking stream EOL.'},

          'koji_config': {

              'type': str,

              'default': None,

@@ -523,26 +523,6 @@ 

      return modules

  

  

- def _is_eol_in_pdc(name, stream):

-     """ Check PDC if the module name:stream is no longer active. """

- 

-     params = {'type': 'module', 'global_component': name, 'name': stream}

-     url = conf.pdc_url + '/component-branches/'

- 

-     response = requests.get(url, params=params)

-     if not response:

-         raise ValidationError("Failed to talk to PDC {}{}".format(response, response.text))

- 

-     data = response.json()

-     results = data['results']

-     if not results:

-         raise ValidationError("No such module {}:{} found at {}".format(

-             name, stream, response.request.url))

- 

-     # If the module is active, then it is not EOL and vice versa.

-     return not results[0]['active']

- 

- 

  def _fetch_mmd(url, branch=None, allow_local_url=False, whitelist_url=False,

                 mandatory_checks=True):

      # Import it here, because SCM uses utils methods

@@ -573,9 +553,7 @@ 

                      td, str(e)))

  

      if conf.check_for_eol:

-         if _is_eol_in_pdc(scm.name, scm.branch):

-             raise ValidationError(

-                 'Module {}:{} is marked as EOL in PDC.'.format(scm.name, scm.branch))

+         pass

  

      if not mandatory_checks:

          return mmd, scm

@@ -414,25 +414,6 @@ 

          # Make sure the build is done

          assert module_build.state == models.BUILD_STATES['ready']

  

-     @patch('module_build_service.config.Config.check_for_eol',

-            new_callable=PropertyMock, return_value=True)

-     @patch('module_build_service.utils.submit._is_eol_in_pdc', return_value=True)

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

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

-     def test_submit_build_eol_module(self, mocked_scm, mocked_get_user, is_eol, check,

-                                      conf_system, dbg):

-         """ Tests the build of a module with an eol stream.  """

-         FakeSCM(mocked_scm, 'python3', 'python3-no-components.yaml',

-                 '620ec77321b2ea7b0d67d82992dda3e1d67055b4')

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

-             {'branch': 'master', 'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/'

-                 'testmodule.git?#620ec77321b2ea7b0d67d82992dda3e1d67055b4'}))

- 

-         assert rv.status_code == 400

-         data = json.loads(rv.data)

-         assert data['status'] == 400

-         assert data['message'] == u'Module python3:master is marked as EOL in PDC.'

- 

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

      @patch('module_build_service.scm.SCM')

      def test_submit_build_from_yaml_not_allowed(

@@ -558,34 +558,6 @@ 

          expected_tag = 'module-1cf457d452e54dda'

          assert tag == expected_tag

  

-     @patch("module_build_service.utils.submit.requests")

-     def test_pdc_eol_check(self, requests):

-         """ Push mock pdc responses through the eol check function. """

- 

-         response = mock.Mock()

-         response.json.return_value = {"results": [{

-             "id": 347907,

-             "global_component": "mariadb",

-             "name": "10.1",

-             "slas": [{

-                 "id": 694207,

-                 "sla": "security_fixes",

-                 "eol": "2019-12-01",

-             }],

-             "type": "module",

-             "active": True,

-             "critical_path": False,

-         }]}

-         requests.get.return_value = response

- 

-         is_eol = module_build_service.utils.submit._is_eol_in_pdc('mariadb', '10.1')

-         assert not is_eol

- 

-         response.json.return_value["results"][0]["active"] = False

- 

-         is_eol = module_build_service.utils.submit._is_eol_in_pdc('mariadb', '10.1')

-         assert is_eol

- 

      def test_get_prefixed_version_f28(self):

          scheduler_init_data(1)

          build_one = models.ModuleBuild.query.get(2)

Signed-off-by: Hunor Csomortáni csomh@redhat.com

@mcurlej @mprahl ptal.

I'm not sure if this change make sense, and if it does, I need advice what should happen with check_for_eol.

@csomh _is_eol_in_pdc is required for Fedora. It's actually a new feature implemented by @ralph. So any PDC config options it doesn't use can be removed.

@mprahl oh, ok, I missed that. I'll update this accordingly.

Yeah, -1. Fedora still relies on PDC for the EOL information about modules (and rpms).

See https://pagure.io/modularity/issue/102

They're working on a replacement for it called 'fpdc', but it won't be ready for a while.

Pull-Request has been closed by ralph

8 months ago