def update(self, conduit, units, options): """ Update the specified content units. Each unit must be of type 'repository'. Updates only the repositories specified in the unit_key by repo_id. :param conduit: A handler conduit. :type conduit: pulp.agent.lib.conduit.Conduit :param units: A list of content unit_keys. :type units: list :param options: Unit update options. :type options: dict :return: An update report. :rtype: ContentReport """ report = ContentReport() progress = HandlerProgress(conduit) repo_ids = [key['repo_id'] for key in units if key] bindings = ParentBinding.fetch(repo_ids) strategy_class = find_strategy(constants.ADDITIVE_STRATEGY) strategy = strategy_class(progress) progress.started(bindings) strategy_report = strategy.synchronize(bindings, options) progress.finished() details = strategy_report.dict() if strategy_report.errors: report.set_failed(details) else: report.set_succeeded(details) return report
def update(self, conduit, units, options): """ Update the specified content units. Each unit must be of type 'node'. Updates the entire child node. :param conduit: A handler conduit. :type conduit: pulp.agent.lib.conduit.Conduit :param units: A list of content unit_keys. :type units: list :param options: Unit update options. :type options: dict :return: An update report. :rtype: ContentReport """ report = ContentReport() progress = HandlerProgress(conduit) bindings = ParentBinding.fetch_all() strategy_name = options.setdefault(constants.STRATEGY_KEYWORD, constants.MIRROR_STRATEGY) strategy_class = find_strategy(strategy_name) strategy = strategy_class(progress) progress.started(bindings) strategy_report = strategy.synchronize(bindings, options) progress.finished() details = strategy_report.dict() if strategy_report.errors: report.set_failed(details) else: report.set_succeeded(details) return report