You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by kh...@apache.org on 2022/03/30 06:36:47 UTC
[pinot] branch master updated: Remove secrets from job spec (#8420)
This is an automated email from the ASF dual-hosted git repository.
kharekartik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 5b44c22 Remove secrets from job spec (#8420)
5b44c22 is described below
commit 5b44c22b46824101381c71e712716e97dd960657
Author: Kartik Khare <kh...@gmail.com>
AuthorDate: Wed Mar 30 12:06:30 2022 +0530
Remove secrets from job spec (#8420)
* remove secrets from job spec
* change function name
---
.../apache/pinot/spi/ingestion/batch/IngestionJobLauncher.java | 5 +----
.../spi/ingestion/batch/spec/SegmentGenerationJobSpec.java | 10 ++++++++++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/pinot-spi/src/main/java/org/apache/pinot/spi/ingestion/batch/IngestionJobLauncher.java b/pinot-spi/src/main/java/org/apache/pinot/spi/ingestion/batch/IngestionJobLauncher.java
index 379a72b..8590aaa 100644
--- a/pinot-spi/src/main/java/org/apache/pinot/spi/ingestion/batch/IngestionJobLauncher.java
+++ b/pinot-spi/src/main/java/org/apache/pinot/spi/ingestion/batch/IngestionJobLauncher.java
@@ -23,7 +23,6 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
-import java.io.StringWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -95,9 +94,7 @@ public class IngestionJobLauncher {
}
public static void runIngestionJob(SegmentGenerationJobSpec spec) {
- StringWriter sw = new StringWriter();
- new Yaml().dump(spec, sw);
- LOGGER.info("SegmentGenerationJobSpec: \n{}", sw.toString());
+ LOGGER.info("SegmentGenerationJobSpec: \n{}", spec.toJSONString(true));
ExecutionFrameworkSpec executionFramework = spec.getExecutionFrameworkSpec();
PinotIngestionJobType jobType = PinotIngestionJobType.fromString(spec.getJobType());
switch (jobType) {
diff --git a/pinot-spi/src/main/java/org/apache/pinot/spi/ingestion/batch/spec/SegmentGenerationJobSpec.java b/pinot-spi/src/main/java/org/apache/pinot/spi/ingestion/batch/spec/SegmentGenerationJobSpec.java
index dfb0a31..15fc9fb 100644
--- a/pinot-spi/src/main/java/org/apache/pinot/spi/ingestion/batch/spec/SegmentGenerationJobSpec.java
+++ b/pinot-spi/src/main/java/org/apache/pinot/spi/ingestion/batch/spec/SegmentGenerationJobSpec.java
@@ -18,8 +18,10 @@
*/
package org.apache.pinot.spi.ingestion.batch.spec;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.Serializable;
import java.util.List;
+import org.apache.pinot.spi.utils.JsonUtils;
/**
@@ -288,4 +290,12 @@ public class SegmentGenerationJobSpec implements Serializable {
public void setAuthToken(String authToken) {
_authToken = authToken;
}
+
+ public String toJSONString(boolean removeSensitiveKeys) {
+ ObjectNode jsonNode = (ObjectNode) JsonUtils.objectToJsonNode(this);
+ if (removeSensitiveKeys) {
+ jsonNode.remove("authToken"); //Removing auth token as it is a sensitive key
+ }
+ return jsonNode.toPrettyString();
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org