Browse Source

[oozie] Upgrade old versions of sqoop nodes

We previously were only upgrading new nodes in the UI, not the ones
already saved and persisted in the workflow.`
Romain Rigaux 10 years ago
parent
commit
be62caaecf
2 changed files with 13 additions and 2 deletions
  1. 9 2
      apps/oozie/src/oozie/models2.py
  2. 4 0
      apps/oozie/src/oozie/tests2.py

+ 9 - 2
apps/oozie/src/oozie/models2.py

@@ -172,6 +172,9 @@ class Workflow(Job):
         if 'retry_interval' not in node['properties']:
           node['properties']['retry_interval'] = []
 
+      # Backward compatibility
+      _upgrade_sqoop_node(node)
+
     return _data
 
   def to_xml(self, mapping=None):
@@ -366,8 +369,7 @@ class Node():
       self.data['properties']['retry_interval'] = []
 
     # Backward compatibility
-    if self.data['type'] == 'sqoop' and 'arguments' not in self.data['properties']:
-      self.data['properties']['arguments'] = self.data['properties']['parameters']
+    _upgrade_sqoop_node(self.data)
 
   def get_template_name(self):
     return 'editor2/gen/workflow-%s.xml.mako' % self.data['type']
@@ -376,6 +378,11 @@ class Node():
     return find_parameters(self) + (find_parameters(self, ['sla']) if self.sla_enabled else [])
 
 
+def _upgrade_sqoop_node(node):
+  if node['type'] in ('sqoop', 'sqoop-widget') and 'arguments' not in node['properties']:
+    node['properties']['arguments'] = node['properties']['parameters']
+
+
 class Action(object):
 
   @classmethod

File diff suppressed because it is too large
+ 4 - 0
apps/oozie/src/oozie/tests2.py


Some files were not shown because too many files changed in this diff