本文整理汇总了Python中pulp.common.bundle.Bundle.split方法的典型用法代码示例。如果您正苦于以下问题:Python Bundle.split方法的具体用法?Python Bundle.split怎么用?Python Bundle.split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp.common.bundle.Bundle
的用法示例。
在下文中一共展示了Bundle.split方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_synchronization
# 需要导入模块: from pulp.common.bundle import Bundle [as 别名]
# 或者: from pulp.common.bundle.Bundle import split [as 别名]
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.
"""
warnings.warn(TASK_DEPRECATION_WARNING, NodeDeprecationWarning)
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
示例2: test_repository
# 需要导入模块: from pulp.common.bundle import Bundle [as 别名]
# 或者: from pulp.common.bundle.Bundle import split [as 别名]
def test_repository(self, *mocks):
# Setup
repository = Repository(REPO_ID)
progress = Mock()
cancelled = Mock(return_value=False)
# Test
options = {
constants.MAX_DOWNLOAD_CONCURRENCY_KEYWORD: MAX_CONCURRENCY,
constants.MAX_DOWNLOAD_BANDWIDTH_KEYWORD: MAX_BANDWIDTH,
constants.PARENT_SETTINGS: PARENT_SETTINGS,
}
repository.run_synchronization(progress, cancelled, options)
binding = mocks[1]
key, certificate = Bundle.split(NODE_CERTIFICATE)
expected_conf = {
importer_constants.KEY_SSL_VALIDATION: False,
importer_constants.KEY_MAX_DOWNLOADS: MAX_CONCURRENCY,
importer_constants.KEY_MAX_SPEED: MAX_BANDWIDTH,
importer_constants.KEY_SSL_CLIENT_KEY: key,
importer_constants.KEY_SSL_CLIENT_CERT: certificate,
}
# Verify
binding.assert_called_with(REPO_ID, expected_conf)
示例3: testSplit
# 需要导入模块: from pulp.common.bundle import Bundle [as 别名]
# 或者: from pulp.common.bundle.Bundle import split [as 别名]
def testSplit(self):
key, crt = Bundle.split(BUNDLE)
self.assertEqual(key.strip(), KEY.strip())
self.assertEqual(crt.strip(), CERTIFICATE.strip())