本文整理汇总了Python中pulp.server.db.model.repository.RepoDistributor.build_resource_tag方法的典型用法代码示例。如果您正苦于以下问题:Python RepoDistributor.build_resource_tag方法的具体用法?Python RepoDistributor.build_resource_tag怎么用?Python RepoDistributor.build_resource_tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp.server.db.model.repository.RepoDistributor
的用法示例。
在下文中一共展示了RepoDistributor.build_resource_tag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_by_distributor_id
# 需要导入模块: from pulp.server.db.model.repository import RepoDistributor [as 别名]
# 或者: from pulp.server.db.model.repository.RepoDistributor import build_resource_tag [as 别名]
def delete_by_distributor_id(repo_id, distributor_id):
"""
Delete all schedules for the specified repo and distributor.
:param distributor_id: unique ID for an distributor
:type distributor_id: basestring
"""
utils.delete_by_resource(RepoDistributor.build_resource_tag(repo_id, distributor_id))
示例2: list
# 需要导入模块: from pulp.server.db.model.repository import RepoDistributor [as 别名]
# 或者: from pulp.server.db.model.repository.RepoDistributor import build_resource_tag [as 别名]
def list(cls, repo_id, distributor_id):
"""
Returns an iterator of ScheduledCall instances that represent schedules
for the specified repo and distributor.
:param repo_id: unique ID for a repository
:type repo_id: basestring
:param distributor_id: unique ID for an distributor
:type distributor_id: basestring
:return: iterator of ScheduledCall instances
:rtype: iterator
"""
cls.validate_distributor(repo_id, distributor_id)
return utils.get_by_resource(RepoDistributor.build_resource_tag(repo_id, distributor_id))
示例3: create
# 需要导入模块: from pulp.server.db.model.repository import RepoDistributor [as 别名]
# 或者: from pulp.server.db.model.repository.RepoDistributor import build_resource_tag [as 别名]
def create(cls, repo_id, distributor_id, publish_options, schedule,
failure_threshold=None, enabled=True):
"""
Create a new scheduled publish for the given repository and distributor.
:param repo_id: unique ID for a repository
:type repo_id: basestring
:param distributor_id: unique ID for an distributor
:type distributor_id: basestring
:param publish_options: dictionary that contains the key 'override_config',
whose value should be passed as the 'overrides'
parameter to the publish task. This wasn't originally
documented, so it isn't clear why overrides value
couldn't be passed directly.
:type sync_options: dict
:param schedule_data: dictionary that contains the key 'schedule', whose
value is an ISO8601 string. This wasn't originally
documented, so it isn't clear why the string itself
couldn't have been passed directly.
:type schedule_data: dict
:return: new schedule instance
:rtype: pulp.server.db.model.dispatch.ScheduledCall
"""
# validate the input
cls.validate_distributor(repo_id, distributor_id)
utils.validate_keys(publish_options, _PUBLISH_OPTION_KEYS)
utils.validate_initial_schedule_options(schedule, failure_threshold, enabled)
task = repo_controller.queue_publish.name
args = [repo_id, distributor_id]
kwargs = {'overrides': publish_options['override_config']}
resource = RepoDistributor.build_resource_tag(repo_id, distributor_id)
schedule = ScheduledCall(schedule, task, args=args, kwargs=kwargs,
resource=resource, failure_threshold=failure_threshold,
enabled=enabled)
schedule.save()
try:
cls.validate_distributor(repo_id, distributor_id)
except exceptions.MissingResource:
# back out of this whole thing, since the distributor disappeared
utils.delete(schedule.id)
raise
return schedule
示例4: test_calls_delete_resource
# 需要导入模块: from pulp.server.db.model.repository import RepoDistributor [as 别名]
# 或者: from pulp.server.db.model.repository.RepoDistributor import build_resource_tag [as 别名]
def test_calls_delete_resource(self, mock_delete_by):
resource = RepoDistributor.build_resource_tag(self.repo, self.distributor)
RepoPublishScheduleManager.delete_by_distributor_id(self.repo, self.distributor)
mock_delete_by.assert_called_once_with(resource)
示例5: test_list
# 需要导入模块: from pulp.server.db.model.repository import RepoDistributor [as 别名]
# 或者: from pulp.server.db.model.repository.RepoDistributor import build_resource_tag [as 别名]
def test_list(self, mock_get_by_resource, mock_validate_distributor):
ret = RepoPublishScheduleManager.list("repo1", "distributor1")
mock_get_by_resource.assert_called_once_with(RepoDistributor.build_resource_tag("repo1", "distributor1"))
self.assertTrue(ret is mock_get_by_resource.return_value)