Skip to content

Instantly share code, notes, and snippets.

@mhrivnak
Forked from jdob/gist:4980468
Created February 18, 2013 20:37
Show Gist options
  • Save mhrivnak/4980483 to your computer and use it in GitHub Desktop.
Save mhrivnak/4980483 to your computer and use it in GitHub Desktop.
def sync_repo(self, repo, sync_conduit, config):
metadata = _fetch_repo_metadata(repo, config)
new_units = _resolve_units_to_download(metadata, sync_conduit)
def _fetch_repo_metadata(repo, config):
"""
Retrieves the listing of Puppet modules at the configured 'feed' location.
:return: list of modules in the external repository
:rtype: list
"""
# Stub method
def _resolve_units_to_download(metadata, sync_conduit):
"""
Analyzes the metadata describing modules in the external repository against those already in
the Pulp repository. The conduit is used to query the Pulp server for the repository's modules.
:return: list of modules that need to be downloaded from the external repository
:rtype: list
"""
# Units currently in the repository
module_criteria = UnitAssociationCriteria(type_ids='puppet_module')
existing_units = self.sync_conduit.get_units(criteria=module_criteria)
# Calculate the difference between existing_units and what is in the metadata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment