Skip to content

Commit

Permalink
Merge pull request pulp#212 from dkliban/1440
Browse files Browse the repository at this point in the history
Adds use of GetLocalUnitsStep to track which units already exist in Pulp
  • Loading branch information
dkliban committed Jan 28, 2016
2 parents 070f59c + 91bc0c5 commit 25e4a85
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions pulp_puppet_plugins/pulp_puppet/plugins/importers/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from nectar.downloaders.threaded import HTTPThreadedDownloader
from nectar.listener import AggregatingEventListener
from nectar.request import DownloadRequest
from pulp.plugins.util import publish_step
from pulp.plugins.util.nectar_config import importer_config_to_nectar_config
from pulp.server.controllers import repository as repo_controller

Expand Down Expand Up @@ -247,18 +248,20 @@ def _import_modules(self, module_paths):

remote_unit_keys = []

list_of_modules = []
for module_path in module_paths:
if self.canceled:
return
puppet_manifest = self._extract_metadata(module_path)
module = Module.from_metadata(puppet_manifest)
remote_unit_keys.append(module.unit_key_str)
list_of_modules.append(module)

pub_step = publish_step.GetLocalUnitsStep(constants.IMPORTER_TYPE_ID, available_units=list_of_modules, repo=self.repo)
pub_step.process_main()
self.report.modules_total_count = len(pub_step.units_to_download)

# Even though we've already basically processed this unit, not doing this makes the
# progress reporting confusing because it shows Pulp always importing all the modules.
if module.unit_key_str in existing_module_ids_by_key:
self.report.modules_total_count -= 1
continue
for module in pub_step.units_to_download:
if self.canceled:
return
_logger.debug(IMPORT_MODULE, dict(mod=module_path))

module.set_storage_path(os.path.basename(module_path))
Expand Down

0 comments on commit 25e4a85

Please sign in to comment.