~ubuntu-branches/ubuntu/utopic/horizon/utopic-updates

« back to all changes in this revision

Viewing changes to openstack_dashboard/dashboards/project/data_processing/cluster_templates/workflows/copy.py

  • Committer: Package Import Robot
  • Author(s): James Page, Chris Johnston, James Page
  • Date: 2014-10-03 17:54:18 UTC
  • mfrom: (0.4.1) (1.1.44) (70.1.2 utopic)
  • Revision ID: package-import@ubuntu.com-20141003175418-1jomx0azdvnl5fxz
Tags: 1:2014.2~rc1-0ubuntu1
[ Chris Johnston ]
* d/theme/css/ubuntu.css: Fix Ubuntu theme for Instances "more" dropdown
  (LP: #1308651).

[ James Page ]
* New upstream release candidate:
  - d/p/*: Refresh.
* d/watch: Use tarballs.openstack.org for upstream releases. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
# See the License for the specific language governing permissions and
12
12
# limitations under the License.
13
13
 
 
14
import base64
 
15
import json
14
16
import logging
15
17
 
16
18
from django.utils.translation import ugettext_lazy as _
28
30
 
29
31
class CopyClusterTemplate(create_flow.ConfigureClusterTemplate):
30
32
    success_message = _("Cluster Template copy %s created")
 
33
    entry_point = "generalconfigaction"
31
34
 
32
35
    def __init__(self, request, context_seed, entry_point, *args, **kwargs):
33
36
        template_id = context_seed["template_id"]
59
62
                        group_name = "group_name_%d" % i
60
63
                        template_id = "template_id_%d" % i
61
64
                        count = "count_%d" % i
62
 
                        ng_action.groups.append({
 
65
                        serialized = "serialized_%d" % i
 
66
 
 
67
                        # save the original node group with all its fields in
 
68
                        # case the template id is missing
 
69
                        serialized_val = base64.urlsafe_b64encode(
 
70
                            json.dumps(wf_helpers.clean_node_group(templ_ng)))
 
71
 
 
72
                        ng = {
63
73
                            "name": templ_ng["name"],
64
 
                            "template_id": templ_ng["node_group_template_id"],
65
74
                            "count": templ_ng["count"],
66
75
                            "id": i,
67
76
                            "deletable": "true",
68
 
                        })
 
77
                            "serialized": serialized_val
 
78
                        }
 
79
                        if "node_group_template_id" in templ_ng:
 
80
                            ng["template_id"] = templ_ng[
 
81
                                "node_group_template_id"]
 
82
                        ng_action.groups.append(ng)
 
83
 
69
84
                        wf_helpers.build_node_group_fields(
70
 
                            ng_action, group_name, template_id, count)
 
85
                            ng_action, group_name, template_id, count,
 
86
                            serialized)
71
87
 
72
88
                elif isinstance(step, create_flow.GeneralConfig):
73
89
                    fields = step.action.fields