Skip to content

Commit

Permalink
Remove modular RPMs if a module is getting removed
Browse files Browse the repository at this point in the history
  • Loading branch information
goosemania committed Sep 18, 2018
1 parent dd4651f commit 7d5f18f
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion plugins/pulp_rpm/plugins/importers/yum/importer.py
Expand Up @@ -6,7 +6,7 @@

from pulp_rpm.common import ids
from pulp_rpm.plugins.db import models
from pulp_rpm.plugins.importers.yum import sync, associate, upload, config_validate
from pulp_rpm.plugins.importers.yum import sync, associate, upload, config_validate, modularity


# The platform currently doesn't support automatic loading of conf files when the plugin
Expand Down Expand Up @@ -83,3 +83,23 @@ def sync_repo(self, transfer_repo, sync_conduit, call_config):
self._current_sync = sync.RepoSync(repo, sync_conduit, call_config)
report = self._current_sync.run()
return report

def remove_units(self, transfer_repo, units, call_config):
"""
Remove units which require plugin specific handling.
Remove Modulemd content units and modular RPMs which belong to them.
Other content unit types are removed by the core in a standard way.
:param transfer_repo: metadata describing the repository
:type trnasfer_repo: pulp.plugins.model.Repository
:param units: list of objects describing the units to remove
:type units: list of pulp.server.db.model.ContentUnit
:param call_config: plugin configuration
:type call_config: pulp.plugins.config.PluginCallConfiguration
"""
repo = transfer_repo.repo_obj
modulemds_to_remove = set(unit.unit_key_as_named_tuple for unit in units
if isinstance(unit, models.Modulemd))
if modulemds_to_remove:
modularity.remove_modulemds(repo, modulemds_to_remove)

0 comments on commit 7d5f18f

Please sign in to comment.