本文整理汇总了Python中pulp.agent.lib.dispatcher.Dispatcher类的典型用法代码示例。如果您正苦于以下问题:Python Dispatcher类的具体用法?Python Dispatcher怎么用?Python Dispatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Dispatcher类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send
def send(self):
"""
Send the content profile(s) to the server.
Delegated to the handlers.
:return: A dispatch report.
:rtype: DispatchReport
"""
bundle = ConsumerX509Bundle()
consumer_id = bundle.cn()
conduit = Conduit()
bindings = PulpBindings()
dispatcher = Dispatcher()
report = dispatcher.profile(conduit)
msg = _('reporting profiles: %(r)s')
log.debug(msg, {'r': report})
for type_id, profile_report in report.details.items():
if not profile_report['succeeded']:
continue
details = profile_report['details']
http = bindings.profile.send(consumer_id, type_id, details)
msg = _('profile (%(t)s), reported: %(r)s')
log.info(msg, {'t': type_id, 'r': http.response_code})
return report.dict()
示例2: unregister
def unregister(self):
"""
Notification that the consumer had been unregistered.
The action is to clean up registration and bind artifacts.
The consumer bundle is deleted. Then, all handlers
are requested to perform a clean().
"""
bundle = ConsumerX509Bundle()
bundle.delete()
conduit = Conduit()
dispatcher = Dispatcher()
report = dispatcher.clean(conduit)
return report.dict()
示例3: uninstall
def uninstall(self, units, options):
"""
Uninstall the specified content units using the specified options.
Delegated to content handlers.
:param units: A list of content units to be uninstalled.
:type units: list of:
{ type_id:<str>, unit_key:<dict> }
:param options: Uninstall options; based on unit type.
:type options: dict
:return: A dispatch report.
:rtype: DispatchReport
"""
conduit = Conduit()
dispatcher = Dispatcher()
report = dispatcher.uninstall(conduit, units, options)
return report.dict()
示例4: unbind
def unbind(self, bindings, options):
"""
Unbind to the specified repository ID.
Delegated to content handlers.
:param bindings: A list of bindings to be removed.
Each binding is: {type_id:<str>, repo_id:<str>}
:type bindings: list
:param options: Unbind options.
:type options: dict
:return: A dispatch report.
:rtype: DispatchReport
"""
conduit = Conduit()
dispatcher = Dispatcher()
report = dispatcher.unbind(conduit, bindings, options)
return report.dict()
示例5: test_handler
def test_handler(*unused):
# publish
self.populate(constants.ADDITIVE_STRATEGY)
pulp_conf.set('server', 'storage_dir', self.parentfs)
dist = NodesHttpDistributor()
repo = Repository(self.REPO_ID)
conduit = RepoPublishConduit(self.REPO_ID, constants.HTTP_DISTRIBUTOR)
dist.publish_repo(repo, conduit, self.dist_conf())
units = [{'type_id':'node', 'unit_key':None}]
pulp_conf.set('server', 'storage_dir', self.childfs)
container = Container(self.parentfs)
dispatcher = Dispatcher(container)
container.handlers[CONTENT]['node'] = NodeHandler(self)
container.handlers[CONTENT]['repository'] = RepositoryHandler(self)
report = dispatcher.update(Conduit(), units, {})
_report.append(report)
示例6: bind
def bind(self, bindings, options):
"""
Bind to the specified repository ID.
Delegated to content handlers.
:param bindings: A list of bindings to add/update.
Each binding is: {type_id:<str>, repo_id:<str>, details:<dict>}
The 'details' are at the discretion of the distributor.
:type bindings: list
:param options: Bind options.
:type options: dict
:return: A dispatch report.
:rtype: DispatchReport
"""
conduit = Conduit()
dispatcher = Dispatcher()
report = dispatcher.bind(conduit, bindings, options)
return report.dict()
示例7: test_handler
def test_handler(*unused):
# publish
self.populate()
pulp_conf.set('server', 'storage_dir', self.upfs)
dist = CitrusHttpDistributor()
repo = Repository(self.REPO_ID)
conduit = RepoPublishConduit(self.REPO_ID, CITRUS_DISTRUBUTOR)
dist.publish_repo(repo, conduit, self.dist_conf())
options = dict(strategy='additive')
units = [{'type_id':'node', 'unit_key':None}]
pulp_conf.set('server', 'storage_dir', self.downfs)
container = Container(self.upfs)
dispatcher = Dispatcher(container)
container.handlers[CONTENT]['node'] = NodeHandler(self)
container.handlers[CONTENT]['repository'] = RepositoryHandler(self)
report = dispatcher.update(Conduit(), units, options)
_report.append(report)