Sfoglia il codice sorgente

[oozie] default credentials in hive actions

Mariusz Strzelecki 10 anni fa
parent
commit
bcd45ed
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      apps/oozie/src/oozie/models2.py

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

@@ -390,7 +390,8 @@ class Action(object):
 
   @classmethod
   def get_fields(cls):
-    return [(f['name'], f['value']) for f in cls.FIELDS.itervalues()] + [('sla', Workflow.SLA_DEFAULT), ('credentials', [])]
+    credentials = [cls.DEFAULT_CREDENTIALS] if hasattr(cls, 'DEFAULT_CREDENTIALS') else []
+    return [(f['name'], f['value']) for f in cls.FIELDS.itervalues()] + [('sla', Workflow.SLA_DEFAULT), ('credentials', credentials)]
 
 
 class StartNode(Action):
@@ -585,6 +586,7 @@ class JavaAction(Action):
 
 class HiveAction(Action):
   TYPE = 'hive'
+  DEFAULT_CREDENTIALS = 'hcat'
   FIELDS = {
      'script_path': {
           'name': 'script_path',
@@ -669,6 +671,7 @@ def _get_hiveserver2_url():
 
 class HiveServer2Action(Action):
   TYPE = 'hive2'
+  DEFAULT_CREDENTIALS = 'hive2'
   FIELDS = {
      'script_path': {
           'name': 'script_path',