• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python report.ContentReport类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: update

    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,代码行数:30,代码来源:handler.py


示例2: update

    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,代码行数:31,代码来源:citrus.py


示例3: install

    def install(cls, conduit, units, options):
        """
        Install content unit(s).

        :param  conduit: A handler conduit
        :type   conduit: pulp.agent.gofer.pulp.Conduit
        :param  units: A list of content unit (keys)
        :type   units: list
        :param  options: Unit install options.
        :type   options: dict

        :return:    An install report.
                    "details" contains a dict with keys "errors" and "successes".
                    "errors" are any operation where the "puppet module" tool
                    returned a non-zero exit code or where the output from that
                    tool indicated an error. Everything else is in "successes".
        :rtype:     pulp.agent.lib.report.ContentReport
        """
        host = options[constants.FORGE_HOST]
        repo_id = options.get(constants.REPO_ID_OPTION)
        successes, errors, num_changes = cls._perform_operation(
            'install', units, cls._generate_forge_url(conduit, host, repo_id))
        report = ContentReport()
        report.set_succeeded({'successes': successes, 'errors': errors}, num_changes)
        return report
开发者ID:christoe,项目名称:pulp_puppet,代码行数:25,代码来源:puppet.py


示例4: update

    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,代码行数:30,代码来源:handler.py


示例5: update

    def update(cls, conduit, units, options):
        """
        Update content unit(s).

        :param  conduit: A handler conduit
        :type   conduit: pulp.agent.gofer.pulp.Conduit
        :param  units: A list of content unit (keys)
        :type   units: list
        :param  options: Unit update options.
        :type   options: dict
        :return:    An update report.
                    "details" contains a dict with keys "errors" and "successes".
                    "errors" are any operation where the "puppet module" tool
                    returned a non-zero exit code or where the output from that
                    tool indicated an error. Everything else is in "successes".
        :rtype:     pulp.agent.lib.report.ContentReport
        """
        host = options[constants.FORGE_HOST]
        repo_id = options.get(constants.REPO_ID_OPTION)
        skip_dep = options.get(constants.SKIP_DEP_OPTION)
        module_path = options.get(constants.MODULEPATH_OPTION)
        successes, errors, num_changes = cls._perform_operation(
            "upgrade", units, cls._generate_forge_url(conduit, host, repo_id), skip_dep, module_path
        )
        report = ContentReport()
        report.set_succeeded({"successes": successes, "errors": errors}, num_changes)
        return report
开发者ID:aeria,项目名称:pulp_puppet,代码行数:27,代码来源:puppet.py


示例6: update

    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,代码行数:60,代码来源:handler.py


示例7: uninstall

    def uninstall(cls, conduit, units, options):
        """
        Uninstall content unit(s). In case dependency conflicts cause an
        uninstall to fail, this will continue to retry the entire collection of
        failed operations until an entire pass results in no successes.

        :param  conduit: A handler conduit
        :type   conduit: pulp.agent.gofer.pulp.Conduit
        :param  units: A list of content unit (keys)
        :type   units: list
        :param  options: Unit uninstall options.
        :type   options: dict
        :return:    An uninstall report.
                    "details" contains a dict with keys "errors" and "successes".
                    "errors" are any operation where the "puppet module" tool
                    returned a non-zero exit code or where the output from that
                    tool indicated an error. Everything else is in "successes".
        :rtype:     pulp.agent.lib.report.ContentReport
        """
        module_path = options.get(constants.MODULEPATH_OPTION)
        previous_failure_count = 0
        successes, errors, num_changes = cls._perform_operation("uninstall", units, None, None, module_path)

        # need this so we can easily access original unit objects when constructing
        # new requests below
        units_by_full_name = dict(("%s/%s" % (u["author"], u["name"]), u) for u in units)

        # loop over the results, and keep trying to uninstall failed attempts as
        # a dumb but effective way of dealing with dependency-related failures.
        # keep trying until we get to an iteration where no more modules are
        # uninstalled.
        while True:
            failed_names = errors.keys()
            if len(failed_names) == 0:
                # success all around! no need to retry
                break
            elif previous_failure_count == 0 or len(failed_names) < previous_failure_count:
                previous_failure_count = len(failed_names)
                failed_units = [units_by_full_name[full_name] for full_name in failed_names]
                # retry the failed attempts
                new_successes, new_errors, new_num_changes = cls._perform_operation(
                    "uninstall", failed_units, None, None, module_path
                )
                num_changes += new_num_changes
                # move new successes from "errors" to "successes"
                successes.update(new_successes)
                for full_name in new_successes.keys():
                    del errors[full_name]
            else:
                # non-zero failure count didn't change, so it's time to give up.
                break

        report = ContentReport()
        report.set_succeeded({"successes": successes, "errors": errors}, num_changes)
        return report
开发者ID:aeria,项目名称:pulp_puppet,代码行数:55,代码来源:puppet.py


示例8: test_update_rendering

 def test_update_rendering(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
     handler_report.set_succeeded(details=summary_report.dict())
     renderer = UpdateRenderer(self.context.prompt, handler_report.dict())
     renderer.render()
     self.assertEqual(len(self.recorder.lines), 32)
开发者ID:dhajoshi,项目名称:pulp,代码行数:11,代码来源:test_admin_extensions.py


示例9: test_update_rendering_with_errors

 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,代码行数:12,代码来源:test_admin_extensions.py


示例10: test_update_rendering

 def test_update_rendering(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
         download_report = DownloadReport()
         download_report.downloads[PRIMARY_ID] = DownloadDetails()
         download_report.downloads['content-world'] = DownloadDetails()
         r.sources = download_report.dict()
     handler_report.set_succeeded(details=summary_report.dict())
     renderer = UpdateRenderer(self.context.prompt, handler_report.dict())
     renderer.render()
     self.assertEqual(len(self.recorder.lines), 59)
开发者ID:credativ,项目名称:pulp,代码行数:15,代码来源:test_admin_extensions.py


示例11: update

    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,代码行数:48,代码来源:handler.py


示例12: test_update_rendering_with_message

 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,代码行数:6,代码来源:test_admin_extensions.py


示例13: set_succeeded

 def set_succeeded(self, details):
     num_changes = \
         len(details['resolved'])+ \
         len(details['deps'])
     ContentReport.set_succeeded(self, details, num_changes)
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:5,代码来源:rpm.py


示例14: set_succeeded

 def set_succeeded(self, details):
     num_changes = len(details["resolved"]) + len(details["deps"])
     ContentReport.set_succeeded(self, details, num_changes)
开发者ID:pcreech,项目名称:pulp_rpm,代码行数:3,代码来源:rpm.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python responses.Task类代码示例发布时间:2022-05-25
下一篇:
Python dispatcher.Dispatcher类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap