diff --git a/atomic_reactor/plugins/pre_resolve_remote_source.py b/atomic_reactor/plugins/pre_resolve_remote_source.py index 294f5916a..9af985470 100644 --- a/atomic_reactor/plugins/pre_resolve_remote_source.py +++ b/atomic_reactor/plugins/pre_resolve_remote_source.py @@ -92,7 +92,7 @@ def run(self): remote_source_json = self.source_request_to_json(source_request) remote_source_url = self.cachito_session.assemble_download_url(source_request) - remote_source_conf_url = self.cachito_session.assemble_request_config_url(source_request) + remote_source_conf_url = remote_source_json.get('configuration_files') self.set_worker_params(source_request, remote_source_url, remote_source_conf_url) dest_dir = self.workflow.source.workdir @@ -122,7 +122,8 @@ def set_worker_params(self, source_request, remote_source_url, remote_source_con def source_request_to_json(self, source_request): """Create a relevant representation of the source request""" required = ('ref', 'repo') - optional = ('dependencies', 'flags', 'packages', 'pkg_managers', 'environment_variables') + optional = ('dependencies', 'flags', 'packages', 'pkg_managers', 'environment_variables', + 'configuration_files') data = {} try: diff --git a/atomic_reactor/utils/cachito.py b/atomic_reactor/utils/cachito.py index 2fa488e99..e2342fd6f 100644 --- a/atomic_reactor/utils/cachito.py +++ b/atomic_reactor/utils/cachito.py @@ -184,18 +184,6 @@ def assemble_download_url(self, request): request_id = self._get_request_id(request) return '{}/api/v1/requests/{}/download'.format(self.api_url, request_id) - def assemble_request_config_url(self, request): - """Return the URL to download the configuration files associated with a request - - :param request: int or dict, either the Cachito request ID or a dict with 'id' key - - :return: str, the URL to download the configuration files - """ - request_id = self._get_request_id(request) - logger.debug('Retrieving configuration files for request %ds', request_id) - url = '{}/api/v1/requests/{}/configuration-files'.format(self.api_url, request_id) - return url - def _get_request_id(self, request): if isinstance(request, int): return request diff --git a/tests/plugins/test_resolve_remote_source.py b/tests/plugins/test_resolve_remote_source.py index 5619ca77d..438b16419 100644 --- a/tests/plugins/test_resolve_remote_source.py +++ b/tests/plugins/test_resolve_remote_source.py @@ -147,6 +147,7 @@ def mock_cachito_api(workflow, user=KOJI_TASK_OWNER, source_request=None, 'version': 'v2.0.3' } ], + 'configuration_files': CACHITO_REQUEST_CONFIG_URL, 'extra_cruft': 'ignored', } @@ -174,11 +175,6 @@ def mock_cachito_api(workflow, user=KOJI_TASK_OWNER, source_request=None, .with_args(source_request) .and_return(CACHITO_REQUEST_DOWNLOAD_URL)) - (flexmock(CachitoAPI) - .should_receive('assemble_request_config_url') - .with_args(source_request) - .and_return(CACHITO_REQUEST_CONFIG_URL)) - def mock_koji(user=KOJI_TASK_OWNER): koji_session = flexmock() @@ -355,6 +351,7 @@ def run_plugin_with_args(workflow, dependency_replacements=None, expect_error=No 'version': 'v2.0.3' } ], + 'configuration_files': CACHITO_REQUEST_CONFIG_URL } assert results['remote_source_path'] == expected_dowload_path(workflow) diff --git a/tests/utils/test_cachito.py b/tests/utils/test_cachito.py index 4a770b8ac..698ba8767 100644 --- a/tests/utils/test_cachito.py +++ b/tests/utils/test_cachito.py @@ -296,13 +296,3 @@ def test_download_sources_bad_request_type(tmpdir): def test_assemble_download_url(tmpdir, cachito_request): url = CachitoAPI(CACHITO_URL).assemble_download_url(cachito_request) assert url == CACHITO_REQUEST_DOWNLOAD_URL - - -@pytest.mark.parametrize('cachito_request', ( - CACHITO_REQUEST_ID, - {'id': CACHITO_REQUEST_ID}, -)) -def test_assemble_request_config_url(tmpdir, cachito_request): - expected = '{}/api/v1/requests/{}/configuration-files'.format(CACHITO_URL, CACHITO_REQUEST_ID) - url = CachitoAPI(CACHITO_URL).assemble_request_config_url(cachito_request) - assert url == expected