def test_retain_old(self, mock_remove_old_versions): self.config.plugin_config[importer_constants.KEY_UNITS_REMOVE_MISSING] = False self.config.plugin_config[importer_constants.KEY_UNITS_RETAIN_OLD_COUNT] = 2 purge.purge_unwanted_units(self.metadata_files, self.conduit, self.config) mock_remove_old_versions.assert_called_once_with(3, self.conduit)
def update_content(self, metadata_files, url): """ Decides what to download and then downloads it :param metadata_files: instance of MetadataFiles :type metadata_files: pulp_rpm.plugins.importers.yum.repomd.metadata.MetadataFiles :param url: curret URL we should sync :type: str """ catalog = PackageCatalog(self.conduit.importer_object_id, url) rpms_to_download, drpms_to_download = self._decide_what_to_download(metadata_files, catalog) self.download_rpms(metadata_files, rpms_to_download, url) self.download_drpms(metadata_files, drpms_to_download, url) failed_signature_check = 0 new_report = [] for error in self.progress_report['content']['error_details']: if error[constants.ERROR_CODE] == constants.ERROR_KEY_ID_FILTER: failed_signature_check += 1 else: new_report.append(error) if failed_signature_check: d = {constants.ERROR_CODE: constants.ERROR_INVALID_PACKAGE_SIG, 'count': '%s' % failed_signature_check} new_report.append(d) self.progress_report['content']['error_details'] = new_report _logger.warning(_('%s packages failed signature filter and were not imported.' % failed_signature_check)) self.conduit.build_success_report({}, {}) # removes unwanted units according to the config settings purge.purge_unwanted_units(metadata_files, self.conduit, self.config)
def test_retain_old(self, mock_remove_old_versions): self.config.plugin_config[importer_constants.KEY_UNITS_REMOVE_MISSING] = False self.config.plugin_config[importer_constants.KEY_UNITS_RETAIN_OLD_COUNT] = 2 purge.purge_unwanted_units(self.metadata_files, self.conduit, self.config) mock_remove_old_versions.assert_called_once_with(3, self.conduit)
def test_remove_missing_false(self, mock_get_remote): self.config.plugin_config[importer_constants.KEY_UNITS_REMOVE_MISSING] = False purge.purge_unwanted_units(self.metadata_files, self.conduit, self.config) # this verifies that no attempt was made to remove missing units, since # nobody looked for missing units. self.assertEqual(mock_get_remote.call_count, 0)
def test_remove_missing_false(self, mock_get_remote): self.config.plugin_config[importer_constants.KEY_UNITS_REMOVE_MISSING] = False purge.purge_unwanted_units(self.metadata_files, self.conduit, self.config) # this verifies that no attempt was made to remove missing units, since # nobody looked for missing units. self.assertEqual(mock_get_remote.call_count, 0)
def test_retain_old_none(self, mock_remove_old_versions): self.config.plugin_config[ importer_constants.KEY_UNITS_REMOVE_MISSING] = False purge.purge_unwanted_units(self.metadata_files, self.conduit, self.config) self.assertEqual(mock_remove_old_versions.call_count, 0)
def update_content(self, metadata_files): """ Decides what to download and then downloads it :param metadata_files: instance of MetadataFiles :type metadata_files: pulp_rpm.plugins.importers.yum.repomd.metadata.MetadataFiles """ rpms_to_download, drpms_to_download = self._decide_what_to_download(metadata_files) self.download(metadata_files, rpms_to_download, drpms_to_download) # removes unwanted units according to the config settings purge.purge_unwanted_units(metadata_files, self.sync_conduit, self.call_config)
def test_remove_missing_true(self, mock_remove_categories, mock_remove_groups, mock_remove_errata, mock_remove_drpms, mock_remove_rpms): self.config.plugin_config[importer_constants.KEY_UNITS_REMOVE_MISSING] = True purge.purge_unwanted_units(self.metadata_files, self.conduit, self.config) mock_remove_rpms.assert_called_once_with(self.metadata_files, self.conduit) mock_remove_drpms.assert_called_once_with(self.metadata_files, self.conduit) mock_remove_errata.assert_called_once_with(self.metadata_files, self.conduit) mock_remove_groups.assert_called_once_with(self.metadata_files, self.conduit) mock_remove_categories.assert_called_once_with(self.metadata_files, self.conduit)
def test_remove_missing_true(self, mock_remove_categories, mock_remove_groups, mock_remove_errata, mock_remove_drpms, mock_remove_rpms, mock_remove_environments): self.config.plugin_config[importer_constants.KEY_UNITS_REMOVE_MISSING] = True purge.purge_unwanted_units(self.metadata_files, self.conduit, self.config) mock_remove_rpms.assert_called_once_with(self.metadata_files, self.conduit) mock_remove_drpms.assert_called_once_with(self.metadata_files, self.conduit) mock_remove_errata.assert_called_once_with(self.metadata_files, self.conduit) mock_remove_groups.assert_called_once_with(self.metadata_files, self.conduit) mock_remove_categories.assert_called_once_with(self.metadata_files, self.conduit) mock_remove_environments.assert_called_once_with(self.metadata_files, self.conduit)
def update_content(self, metadata_files): """ Decides what to download and then downloads it :param metadata_files: instance of MetadataFiles :type metadata_files: pulp_rpm.plugins.importers.yum.repomd.metadata.MetadataFiles """ rpms_to_download, drpms_to_download = self._decide_what_to_download( metadata_files) self.download(metadata_files, rpms_to_download, drpms_to_download) # removes unwanted units according to the config settings purge.purge_unwanted_units(metadata_files, self.sync_conduit, self.call_config)
def update_content(self, metadata_files, url): """ Decides what to download and then downloads it :param metadata_files: instance of MetadataFiles :type metadata_files: pulp_rpm.plugins.importers.yum.repomd.metadata.MetadataFiles :param url: curret URL we should sync :type: str """ rpms_to_download, drpms_to_download = self._decide_what_to_download(metadata_files) self.download_rpms(metadata_files, rpms_to_download, url) self.download_drpms(metadata_files, drpms_to_download, url) self.conduit.build_success_report({}, {}) # removes unwanted units according to the config settings purge.purge_unwanted_units(metadata_files, self.conduit, self.config)
def update_content(self, metadata_files, url): """ Decides what to download and then downloads it :param metadata_files: instance of MetadataFiles :type metadata_files: pulp_rpm.plugins.importers.yum.repomd.metadata.MetadataFiles :param url: curret URL we should sync :type: str """ rpms_to_download, drpms_to_download = self._decide_what_to_download(metadata_files) self.download_rpms(metadata_files, rpms_to_download, url) self.download_drpms(metadata_files, drpms_to_download, url) self.conduit.build_success_report({}, {}) # removes unwanted units according to the config settings purge.purge_unwanted_units(metadata_files, self.conduit, self.config)
def test_retain_old_none(self, mock_remove_old_versions): self.config.plugin_config[importer_constants.KEY_UNITS_REMOVE_MISSING] = False purge.purge_unwanted_units(self.metadata_files, self.conduit, self.config) self.assertEqual(mock_remove_old_versions.call_count, 0)