Browse Source

HUE-1122 [oozie] Propagate configuration option is always checked in Sub workflow action

Abraham Elmahrek 12 years ago
parent
commit
2932c6e

+ 1 - 1
apps/oozie/src/oozie/templates/editor/action_utils.mako

@@ -149,7 +149,7 @@
 
           % for field in action_form:
             % if field.html_name not in ('name', 'description', 'node_type', 'job_xml'):
-              % if field.html_name in ('capture_output', 'is_single', 'sub_workflow'):
+              % if field.html_name in ('capture_output', 'is_single', 'sub_workflow', 'propagate_configuration'):
                 ${ utils.render_field_with_error_js(field, field.name, extra_attrs={'data-bind': 'disable: $root.context().read_only, checked: %s' % field.name}) }
               % else:
                 ${ utils.render_field_with_error_js(field, field.name, extra_attrs={'data-bind': 'disable: $root.context().read_only, value: %s' % field.name}) }

+ 3 - 0
apps/oozie/src/oozie/utils.py

@@ -30,6 +30,7 @@ LOG = logging.getLogger(__name__)
 
 JSON_FIELDS = ('parameters', 'job_properties', 'files', 'archives', 'prepares', 'params',
                'deletes', 'mkdirs', 'moves', 'chmods', 'touchzs')
+BOOLEAN_FIELDS = ('propagate_configuration','capture_output')
 NUMBER_FIELDS = ('sub_workflow',)
 
 def format_field_value(field, value):
@@ -39,6 +40,8 @@ def format_field_value(field, value):
   if field in NUMBER_FIELDS:
     if not isinstance(value, int):
       return int(value)
+  if field in BOOLEAN_FIELDS:
+    return str(value).lower() == 'true'
   return value
 
 

+ 6 - 3
apps/oozie/src/oozie/views/api.py

@@ -52,9 +52,6 @@ def get_or_create_node(workflow, node_data):
   node_model = NODE_TYPES.get(node_type, None)
   kwargs = {'workflow': workflow, 'node_type': node_data['node_type']}
 
-  if node_data['node_type'] == 'subworkflow':
-    kwargs['sub_workflow'] = Workflow.objects.get(id=int(node_data['sub_workflow']))
-
   if node_model:
     node = node_model(**kwargs)
   else:
@@ -199,6 +196,12 @@ def _update_workflow_nodes_json(workflow, json_nodes, id_map, user):
     if node.node_type == 'fork' and json_node['node_type'] == 'decision':
       node = node.convert_to_decision()
 
+    if node.node_type == 'subworkflow':
+      try:
+        node.sub_workflow = Workflow.objects.get(id=int(json_node['sub_workflow']))
+      except Workflow.DoesNotExist:
+        pass
+
     id_map[str(json_node['id'])] = node.id
 
     for key in json_node: