def run_synchronization(self, progress, cancelled, options): """ Run a repo_sync() on this repository. :param progress: A progress report. :type progress: pulp_node.progress.RepositoryProgress :param options: node synchronization options. :type options: dict :return: The task result. """ bindings = resources.pulp_bindings() poller = TaskPoller(bindings) max_download = options.get( constants.MAX_DOWNLOAD_CONCURRENCY_KEYWORD, constants.DEFAULT_DOWNLOAD_CONCURRENCY) node_certificate = options[constants.PARENT_SETTINGS][constants.NODE_CERTIFICATE] key, certificate = Bundle.split(node_certificate) configuration = { importer_constants.KEY_MAX_DOWNLOADS: max_download, importer_constants.KEY_MAX_SPEED: options.get(constants.MAX_DOWNLOAD_BANDWIDTH_KEYWORD), importer_constants.KEY_SSL_CLIENT_KEY: key, importer_constants.KEY_SSL_CLIENT_CERT: certificate, importer_constants.KEY_SSL_VALIDATION: False, } http = bindings.repo_actions.sync(self.repo_id, configuration) if http.response_code != httplib.ACCEPTED: raise RepoSyncRestError(self.repo_id, http.response_code) # The repo sync is returned with a single sync task in the Call Report task = http.response_body.spawned_tasks[0] result = poller.join(task.task_id, progress, cancelled) if cancelled(): self._cancel_synchronization(task) return result
def run_synchronization(self, progress, cancelled): """ Run a repo_sync() on this child repository. :param progress: A progress report. :type progress: pulp_node.progress.RepositoryProgress :return: The task result. """ poller = TaskPoller(self.binding) http = self.binding.repo_actions.sync(self.repo_id, {}) if http.response_code != httplib.ACCEPTED: raise RepoSyncRestError(self.repo_id, http.response_code) task = http.response_body[0] result = poller.join(task.task_id, progress, cancelled) if cancelled(): self._cancel_synchronization(task) return result