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

Commit 093effc

Browse files
committed
Parse NULL as empty for TaskSpec env map (#3184)
1 parent 0780761 commit 093effc

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

  • frameworks/helloworld/src/main/dist
  • sdk/scheduler/src/main/java/com/mesosphere/sdk/specification/yaml

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pods:
2424
type: ROOT
2525
size: {{HELLO_DISK}}
2626
env:
27+
PARSE_EMPTY_KEY_AS_BLANK_TEST:
2728
SLEEP_DURATION: {{SLEEP_DURATION}}
2829
health-check:
2930
cmd: stat hello-container-path/output

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

Lines changed: 4 additions & 3 deletions
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)