Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit cee6095

Browse files
authored
Parse NULL as empty for TaskSpec env map (#3184)
1 parent 6d6703f commit cee6095

File tree

2 files changed

+5
-3
lines changed
  • frameworks/helloworld/src/main/dist
  • sdk/scheduler/src/main/java/com/mesosphere/sdk/specification/yaml

2 files changed

+5
-3
lines changed

frameworks/helloworld/src/main/dist/svc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pods:
2121
type: ROOT
2222
size: {{HELLO_DISK}}
2323
env:
24+
PARSE_EMPTY_KEY_AS_BLANK_TEST:
2425
SLEEP_DURATION: {{SLEEP_DURATION}}
2526
health-check:
2627
cmd: stat hello-container-path/output

sdk/scheduler/src/main/java/com/mesosphere/sdk/specification/yaml/RawTask.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.mesosphere.sdk.specification.yaml;
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import com.fasterxml.jackson.annotation.JsonSetter;
5+
import com.fasterxml.jackson.annotation.Nulls;
46
import org.apache.mesos.Protos;
57

68
import java.util.Collections;
@@ -20,7 +22,8 @@ public final class RawTask {
2022

2123
private final String labelsCsv;
2224

23-
private final Map<String, String> env;
25+
@JsonSetter(contentNulls = Nulls.AS_EMPTY)
26+
private Map<String, String> env;
2427

2528
private final WriteOnceLinkedHashMap<String, RawConfig> configs;
2629

@@ -57,7 +60,6 @@ private RawTask(
5760
@JsonProperty("essential") Boolean essential,
5861
@JsonProperty("cmd") String cmd,
5962
@JsonProperty("labels") String labels,
60-
@JsonProperty("env") Map<String, String> env,
6163
@JsonProperty("configs") WriteOnceLinkedHashMap<String, RawConfig> configs,
6264
@JsonProperty("cpus") Double cpus,
6365
@JsonProperty("gpus") Double gpus,
@@ -78,7 +80,6 @@ private RawTask(
7880
this.essential = essential;
7981
this.cmd = cmd;
8082
this.labelsCsv = labels;
81-
this.env = env;
8283
this.configs = configs;
8384
this.cpus = cpus;
8485
this.gpus = gpus;

0 commit comments

Comments
 (0)