当前位置: 首页>>代码示例>>Python>>正文


Python ContentReport.set_failed方法代码示例

本文整理汇总了Python中pulp.agent.lib.report.ContentReport.set_failed方法的典型用法代码示例。如果您正苦于以下问题:Python ContentReport.set_failed方法的具体用法?Python ContentReport.set_failed怎么用?Python ContentReport.set_failed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pulp.agent.lib.report.ContentReport的用法示例。


在下文中一共展示了ContentReport.set_failed方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_failed [as 别名]
    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)
        progress.push_step('fetch_bindings')
        repo_ids = [key['repo_id'] for key in units if key]
        bindings = RemoteBinding.fetch(repo_ids)

        strategy_class = find_strategy('additive')
        strategy = strategy_class(progress)
        strategy_report = strategy.synchronize(bindings, options)

        progress.end()
        details = strategy_report.dict()
        if strategy_report.errors:
            report.set_failed(details)
        else:
            report.set_succeeded(details)
        return report
开发者ID:pieska,项目名称:pulp,代码行数:33,代码来源:citrus.py

示例2: update

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_failed [as 别名]
    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 = SummaryReport()
        progress = HandlerProgress(conduit)
        repo_ids = [key['repo_id'] for key in units if key]
        bindings = BindingsOnParent.fetch(repo_ids)

        strategy_class = find_strategy(constants.ADDITIVE_STRATEGY)
        strategy = strategy_class(progress, report)
        progress.started(bindings)
        strategy.synchronize(bindings, options)

        handler_report = ContentReport()
        if report.succeeded():
            handler_report.set_succeeded(report.dict())
        else:
            handler_report.set_failed(report.dict())
        return handler_report
开发者ID:msurovcak,项目名称:pulp,代码行数:32,代码来源:handler.py

示例3: update

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_failed [as 别名]
    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
开发者ID:juwu,项目名称:pulp,代码行数:32,代码来源:handler.py

示例4: update

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_failed [as 别名]
    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.

        Report format:
          succeeded: <bool>
          details: {
            errors: [
              { error_id: <str>,
                details: {}
              },
            ]
            repositories: [
              { repo_id: <str>,
                action: <str>,
                units: {
                  added: <int>,
                  updated: <int>,
                  removed: <int>
                }
              },
            ]
          }

        :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
        """
        summary_report = SummaryReport()
        progress_report = HandlerProgress(conduit)
        repo_ids = [key['repo_id'] for key in units if key]
        bindings = BindingsOnParent.fetch(repo_ids)

        strategy_name = options.setdefault(constants.STRATEGY_KEYWORD, constants.MIRROR_STRATEGY)
        request = SyncRequest(
            conduit=conduit,
            progress=progress_report,
            summary=summary_report,
            bindings=bindings,
            scope=constants.REPOSITORY_SCOPE,
            options=options)
        strategy = find_strategy(strategy_name)()
        strategy.synchronize(request)

        for ne in summary_report.errors:
            log.error(ne)

        handler_report = ContentReport()
        if summary_report.succeeded():
            handler_report.set_succeeded(summary_report.dict())
        else:
            handler_report.set_failed(summary_report.dict())
        return handler_report
开发者ID:cliffy94,项目名称:pulp,代码行数:62,代码来源:handler.py

示例5: test_update_rendering_with_errors

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_failed [as 别名]
 def test_update_rendering_with_errors(self):
     repo_ids = ['repo_%d' % n for n in range(0, 3)]
     handler_report = ContentReport()
     summary_report = SummaryReport()
     summary_report.setup([{'repo_id': r} for r in repo_ids])
     for r in summary_report.repository.values():
         r.action = RepositoryReport.ADDED
     summary_report.errors.append(UnitDownloadError('http://abc/x.rpm', repo_ids[0], dict(response_code=401)))
     handler_report.set_failed(details=summary_report.dict())
     renderer = UpdateRenderer(self.context.prompt, handler_report.dict())
     renderer.render()
     self.assertEqual(len(self.recorder.lines), 42)
开发者ID:dhajoshi,项目名称:pulp,代码行数:14,代码来源:test_admin_extensions.py

示例6: update

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_failed [as 别名]
    def update(self, conduit, units, options):
        """
        Update the specified content units.  Each unit must be of
        type 'node'.  Updates the entire child node.

        Report format:
          succeeded: <bool>
          details: {
            errors: [
              { error_id: <str>,
                details: {}
              },
            ]
            repositories: [
              { repo_id: <str>,
                action: <str>,
                units: {
                  added: <int>,
                  updated: <int>,
                  removed: <int>
                }
              },
            ]
          }

        :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
        """
        warnings.warn(TASK_DEPRECATION_WARNING, NodeDeprecationWarning)

        handler_report = ContentReport()
        summary_report = SummaryReport()
        progress_report = HandlerProgress(conduit)
        pulp_bindings = parent_bindings(options)

        try:
            bindings = RepositoryBinding.fetch_all(pulp_bindings, conduit.consumer_id)
        except GetBindingsError, ne:
            log.error(ne)
            summary_report.errors.append(ne)
            handler_report.set_failed(summary_report.dict())
            return handler_report
开发者ID:BrnoPCmaniak,项目名称:pulp,代码行数:50,代码来源:handler.py

示例7: test_update_rendering_with_message

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_failed [as 别名]
 def test_update_rendering_with_message(self):
     handler_report = ContentReport()
     handler_report.set_failed(details=dict(message='Authorization Failed'))
     renderer = UpdateRenderer(self.context.prompt, handler_report.dict())
     renderer.render()
     self.assertEqual(len(self.recorder.lines), 4)
开发者ID:credativ,项目名称:pulp,代码行数:8,代码来源:test_admin_extensions.py


注:本文中的pulp.agent.lib.report.ContentReport.set_failed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。