فهرست منبع

HUE-3969 [oozie] Create a new workflow js error

Updates the properties with defaults for any undefined properties in the saved configuration
Jenny Kim 10 سال پیش
والد
کامیت
bb6addc
2فایلهای تغییر یافته به همراه11 افزوده شده و 6 حذف شده
  1. 5 4
      apps/oozie/src/oozie/models2.py
  2. 6 2
      apps/oozie/src/oozie/tests2.py

+ 5 - 4
apps/oozie/src/oozie/models2.py

@@ -282,22 +282,23 @@ class Workflow(Job):
   def get_workflow_properties_for_user(cls, user, workflow=None):
     workflow = workflow if workflow is not None else {}
     properties = workflow.get('properties', None)
+
     if not properties:
       config = None
+      properties = cls.get_properties()
+
       if user is not None:
-        config = None
         if USE_DEFAULT_CONFIGURATION.get():
           config = DefaultConfiguration.objects.get_configuration_for_user(app=WorkflowConfiguration.APP_NAME, user=user)
 
       if config is not None:
-        properties = config.properties_dict
-      else:
-        properties = cls.get_properties()
+        properties.update(config.properties_dict)
 
       properties.update({
         'wf1_id': None,
         'description': ''
       })
+
     return properties
 
   @staticmethod

+ 6 - 2
apps/oozie/src/oozie/tests2.py

@@ -465,9 +465,11 @@ LIMIT $limit"""))
           'type': 'settings'
         }
       ]
+
+      wf_props = Workflow.get_properties()
       config = DefaultConfiguration(app=WorkflowConfiguration.APP_NAME, properties=json.dumps(properties), is_default=True)
       config.save()
-      wf_props = config.properties_dict
+      wf_props.update(config.properties_dict)
       wf_props.update({'wf1_id': None, 'description': ''})
 
       # Test that a new workflow will be initialized with Default saved config if it exists
@@ -495,12 +497,14 @@ LIMIT $limit"""))
             'type': 'settings'
         }
       ]
+
+      wf_props = Workflow.get_properties()
       config = DefaultConfiguration.objects.create(app=WorkflowConfiguration.APP_NAME,
         properties=json.dumps(properties),
         is_default=False)
       config.groups.add(self.user.groups.first())
       config.save()
-      wf_props = config.properties_dict
+      wf_props.update(config.properties_dict)
       wf_props.update({'wf1_id': None, 'description': ''})
 
       # Test that a new workflow will be initialized with Default saved config if it exists