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


Python ContentReport.set_succeeded方法代码示例

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


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

示例1: install

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_succeeded [as 别名]
    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,代码行数:27,代码来源:puppet.py

示例2: update

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_succeeded [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_succeeded [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)
        progress.push_step('fetch_bindings')
        bindings = RemoteBinding.fetch_all()

        strategy_name = options.setdefault('strategy', 'mirror')
        strategy_class = find_strategy(strategy_name)
        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,代码行数:32,代码来源:citrus.py

示例4: update

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

示例5: update

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_succeeded [as 别名]
    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,代码行数:29,代码来源:puppet.py

示例6: update

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

示例7: uninstall

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_succeeded [as 别名]
    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,代码行数:57,代码来源:puppet.py

示例8: test_update_rendering

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_succeeded [as 别名]
 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,代码行数:13,代码来源:test_admin_extensions.py

示例9: test_update_rendering

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_succeeded [as 别名]
 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,代码行数:17,代码来源:test_admin_extensions.py

示例10: set_succeeded

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_succeeded [as 别名]
 def set_succeeded(self, details):
     num_changes = \
         len(details['resolved'])+ \
         len(details['deps'])
     ContentReport.set_succeeded(self, details, num_changes)
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:7,代码来源:rpm.py

示例11: set_succeeded

# 需要导入模块: from pulp.agent.lib.report import ContentReport [as 别名]
# 或者: from pulp.agent.lib.report.ContentReport import set_succeeded [as 别名]
 def set_succeeded(self, details):
     num_changes = len(details["resolved"]) + len(details["deps"])
     ContentReport.set_succeeded(self, details, num_changes)
开发者ID:pcreech,项目名称:pulp_rpm,代码行数:5,代码来源:rpm.py


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