gobblin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [4/9] incubator-gobblin git commit: Add ability to read and override Azkaban password from environment
Date Wed, 30 Aug 2017 15:55:30 GMT
Add ability to read and override Azkaban password from environment


Project: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/commit/2164a1e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/tree/2164a1e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/diff/2164a1e6

Branch: refs/heads/master
Commit: 2164a1e6a8c2cc556f070bfab11409a701bcddd5
Parents: f423d7d
Author: Abhishek Tiwari <abhishektiwari.btech@gmail.com>
Authored: Wed Aug 30 00:36:12 2017 -0700
Committer: Abhishek Tiwari <abhishektiwari.btech@gmail.com>
Committed: Wed Aug 30 00:36:12 2017 -0700

----------------------------------------------------------------------
 .../AzkabanSpecExecutorInstanceProducer.java             | 11 ++++++++++-
 .../modules/orchestration/ServiceAzkabanConfigKeys.java  |  3 +++
 2 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/2164a1e6/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanSpecExecutorInstanceProducer.java
----------------------------------------------------------------------
diff --git a/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanSpecExecutorInstanceProducer.java
b/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanSpecExecutorInstanceProducer.java
index f093af2..5471f0c 100644
--- a/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanSpecExecutorInstanceProducer.java
+++ b/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanSpecExecutorInstanceProducer.java
@@ -23,6 +23,7 @@ import java.util.List;
 import java.util.concurrent.Future;
 
 import org.apache.commons.codec.EncoderException;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.gobblin.runtime.api.JobSpec;
 import org.apache.gobblin.runtime.api.Spec;
 import org.apache.gobblin.runtime.api.SpecExecutorInstanceProducer;
@@ -47,7 +48,7 @@ public class AzkabanSpecExecutorInstanceProducer extends AzkabanSpecExecutorInst
     try {
       // Initialize Azkaban client / producer and cache credentials
       String azkabanUsername = config.getString(ServiceAzkabanConfigKeys.AZKABAN_USERNAME_KEY);
-      String azkabanPassword = config.getString(ServiceAzkabanConfigKeys.AZKABAN_PASSWORD_KEY);
+      String azkabanPassword = getAzkabanPassword(config);
       String azkabanServerUrl = config.getString(ServiceAzkabanConfigKeys.AZKABAN_SERVER_URL_KEY);
 
       sessionId = AzkabanAjaxAPIClient.authenticateAndGetSessionId(azkabanUsername, azkabanPassword,
azkabanServerUrl);
@@ -56,6 +57,14 @@ public class AzkabanSpecExecutorInstanceProducer extends AzkabanSpecExecutorInst
     }
   }
 
+  private String getAzkabanPassword(Config config) {
+    if (StringUtils.isNotBlank(System.getProperty(ServiceAzkabanConfigKeys.AZKABAN_PASSWORD_SYSTEM_KEY)))
{
+      return System.getProperty(ServiceAzkabanConfigKeys.AZKABAN_PASSWORD_SYSTEM_KEY);
+    }
+
+    return ConfigUtils.getString(config, ServiceAzkabanConfigKeys.AZKABAN_PASSWORD_KEY, StringUtils.EMPTY);
+  }
+
   public AzkabanSpecExecutorInstanceProducer(Config config, Logger log) {
     this(config, Optional.of(log));
   }

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/2164a1e6/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/ServiceAzkabanConfigKeys.java
----------------------------------------------------------------------
diff --git a/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/ServiceAzkabanConfigKeys.java
b/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/ServiceAzkabanConfigKeys.java
index 762561c..b712a5a 100644
--- a/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/ServiceAzkabanConfigKeys.java
+++ b/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/ServiceAzkabanConfigKeys.java
@@ -34,5 +34,8 @@ public class ServiceAzkabanConfigKeys {
   public static final String AZKABAN_PROJECT_ZIP_FAIL_IF_JARNOTFOUND_KEY = GOBBLIN_SERVICE_AZKABAN_PREFIX
+ "project.zip.failIfJarNotFound";
   public static final String AZKABAN_PROJECT_ZIP_ADDITIONAL_FILE_URLS_KEY = GOBBLIN_SERVICE_AZKABAN_PREFIX
+ "project.zip.additionalFilesUrl";
   public static final String AZKABAN_PROJECT_OVERWRITE_IF_EXISTS_KEY = GOBBLIN_SERVICE_AZKABAN_PREFIX
+ "project.overwriteIfExists";
+
+  // Azkaban System Environment
+  public static final String AZKABAN_PASSWORD_SYSTEM_KEY = "GOBBLIN_SERVICE_AZKABAN_PASSWORD";
 }
 


Mime
View raw message