當前位置: 首頁>>代碼示例>>Python>>正文


Python DeploymentGraph.update方法代碼示例

本文整理匯總了Python中nailgun.objects.DeploymentGraph.update方法的典型用法代碼示例。如果您正苦於以下問題:Python DeploymentGraph.update方法的具體用法?Python DeploymentGraph.update怎麽用?Python DeploymentGraph.update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在nailgun.objects.DeploymentGraph的用法示例。


在下文中一共展示了DeploymentGraph.update方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: update

# 需要導入模塊: from nailgun.objects import DeploymentGraph [as 別名]
# 或者: from nailgun.objects.DeploymentGraph import update [as 別名]
    def update(cls, instance, data):
        """Update existing Release instance with specified parameters.

        :param instance: Release instance
        :param data: dictionary of key-value pairs as object fields
        :returns: Release instance
        """
        # in order to be compatible with old API, let's drop input
        # roles array. since fuel 7.0 we don't use it anymore, and
        # we don't require it even for old releases.
        data.pop("roles", None)

        graphs = data.pop("graphs", {})
        deployment_tasks = data.pop("deployment_tasks", [])

        existing_default_graph = DeploymentGraph.get_for_model(
            instance, consts.DEFAULT_DEPLOYMENT_GRAPH_TYPE)

        if (existing_default_graph and len(deployment_tasks)) \
                or not existing_default_graph:
            graphs[consts.DEFAULT_DEPLOYMENT_GRAPH_TYPE] = \
                {'tasks': deployment_tasks}
        release_obj = super(Release, cls).update(instance, data)

        for graph_type, graph_data in six.iteritems(graphs):
            g = DeploymentGraph.get_for_model(instance, graph_type)
            if g:
                DeploymentGraph.update(g, graph_data)
            else:
                DeploymentGraph.create_for_model(
                    graph_data, instance, graph_type)

        return release_obj
開發者ID:mmalchuk,項目名稱:openstack-fuel-web,代碼行數:35,代碼來源:release.py

示例2: test_get_deployment_tasks_params_not_changed

# 需要導入模塊: from nailgun.objects import DeploymentGraph [as 別名]
# 或者: from nailgun.objects.DeploymentGraph import update [as 別名]
 def test_get_deployment_tasks_params_not_changed(self):
     expected = 'path/to/some/dir'
     dg = DeploymentGraph.get_for_model(self.plugin_adapter.plugin)
     DeploymentGraph.update(
         dg,
         {
             'tasks': self.env.get_default_plugin_deployment_tasks(
                 parameters={'cwd': expected})
         }
     )
     depl_task = self.plugin_adapter.get_deployment_tasks()[0]
     self.assertEqual(depl_task['parameters'].get('cwd'), expected)
開發者ID:openstack,項目名稱:fuel-web,代碼行數:14,代碼來源:test_plugin_adapters.py

示例3: test_get_deployment_tasks

# 需要導入模塊: from nailgun.objects import DeploymentGraph [as 別名]
# 或者: from nailgun.objects.DeploymentGraph import update [as 別名]
    def test_get_deployment_tasks(self):
        dg = DeploymentGraph.get_for_model(self.plugin_adapter.plugin)
        DeploymentGraph.update(
            dg,
            {
                'tasks': self.env.get_default_plugin_deployment_tasks()
            }
        )

        depl_task = self.plugin_adapter.get_deployment_tasks()[0]
        self.assertEqual(depl_task['parameters'].get('cwd'),
                         self.plugin_adapter.slaves_scripts_path)
開發者ID:openstack,項目名稱:fuel-web,代碼行數:14,代碼來源:test_plugin_adapters.py

示例4: get_deployment_graph

# 需要導入模塊: from nailgun.objects import DeploymentGraph [as 別名]
# 或者: from nailgun.objects.DeploymentGraph import update [as 別名]
    def get_deployment_graph(cls, instance, graph_type=None):
        """Get deployment graph based on release version.

        :param instance: Release instance
        :type instance: models.Release
        :param graph_type: deployment graph type
        :type graph_type: basestring|None
        :returns: list of deployment tasks
        :rtype: list
        """
        if graph_type is None:
            graph_type = consts.DEFAULT_DEPLOYMENT_GRAPH_TYPE

        env_version = instance.environment_version

        deployment_graph = DeploymentGraph.get_for_model(instance, graph_type)
        if deployment_graph:
            deployment_tasks = DeploymentGraph.get_tasks(deployment_graph)
        else:
            # deployment tasks list should always be returned
            deployment_tasks = []

        if graph_type == consts.DEFAULT_DEPLOYMENT_GRAPH_TYPE and \
                not deployment_tasks:
            # upload default legacy graphs
            if env_version.startswith('5.0'):
                deployment_tasks = yaml.load(
                    graph_configuration.DEPLOYMENT_50)
            elif env_version.startswith('5.1') \
                    or env_version.startswith('6.0'):
                deployment_tasks = yaml.load(
                    graph_configuration.DEPLOYMENT_51_60)

            if deployment_graph:
                if deployment_tasks:
                    DeploymentGraph.update(
                        deployment_graph, {'tasks': deployment_tasks})
            else:
                # create graph anyway
                deployment_graph = DeploymentGraph.create_for_model(
                    {'tasks': deployment_tasks}, instance)

        if deployment_graph:
            metadata = DeploymentGraph.get_metadata(deployment_graph)
        else:
            metadata = {}

        metadata['tasks'] = deployment_tasks
        return metadata
開發者ID:mmalchuk,項目名稱:openstack-fuel-web,代碼行數:51,代碼來源:release.py

示例5: update

# 需要導入模塊: from nailgun.objects import DeploymentGraph [as 別名]
# 或者: from nailgun.objects.DeploymentGraph import update [as 別名]
    def update(cls, instance, data):
        graphs = {}
        data_graphs = data.pop("graphs", [])
        for graph in data_graphs:
            graphs[graph.pop('type')] = graph

        data.pop("deployment_tasks", [])    # could not be updated
        super(Plugin, cls).update(instance, data)

        for graph_type, graph_data in six.iteritems(graphs):
            existing_graph = DeploymentGraph.get_for_model(
                instance, graph_type=graph_type)
            if existing_graph:
                DeploymentGraph.update(existing_graph, graph_data)
            else:
                DeploymentGraph.create_for_model(
                    graph_data, instance, graph_type)
開發者ID:sebrandon1,項目名稱:fuel-web,代碼行數:19,代碼來源:plugin.py

示例6: update

# 需要導入模塊: from nailgun.objects import DeploymentGraph [as 別名]
# 或者: from nailgun.objects.DeploymentGraph import update [as 別名]
    def update(cls, instance, data):
        """Update existing Release instance with specified parameters.

        :param instance: Release instance
        :param data: dictionary of key-value pairs as object fields
        :returns: Release instance
        """
        # in order to be compatible with old API, let's drop input
        # roles array. since fuel 7.0 we don't use it anymore, and
        # we don't require it even for old releases.
        data.pop("roles", None)
        deployment_tasks = data.pop("deployment_tasks", None)
        release_obj = super(Release, cls).update(instance, data)
        if deployment_tasks:
            deployment_graph_instance = DeploymentGraph.get_for_model(instance)
            DeploymentGraph.update(deployment_graph_instance,
                                   {'tasks': deployment_tasks})
        return release_obj
開發者ID:jiaolongsun,項目名稱:fuel-web,代碼行數:20,代碼來源:release.py


注:本文中的nailgun.objects.DeploymentGraph.update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。