浏览代码

Merge pull request #199 from szczeles/oozie_credentials

[Oozie] Provide default credentials in hive actions
Romain Rigaux 10 年之前
父节点
当前提交
2f6e86d
共有 1 个文件被更改,包括 4 次插入1 次删除
  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',