@@ -166,7 +166,7 @@ const (
166166
167167 ipv6LoopbackAddress = "::1"
168168
169- PAUSE_LABELS_ENV_VAR = "ECS_PAUSE_LABELS"
169+ pauseLabelsEnvVar = "ECS_PAUSE_LABELS"
170170)
171171
172172// TaskOverrides are the overrides applied to a task
@@ -1817,7 +1817,7 @@ func (task *Task) dockerConfig(container *apicontainer.Container, apiVersion doc
18171817
18181818 switch container .Type {
18191819 case apicontainer .ContainerCNIPause , apicontainer .ContainerNamespacePause :
1820- if pauseLabels := os .Getenv (PAUSE_LABELS_ENV_VAR ); pauseLabels != "" {
1820+ if pauseLabels := os .Getenv (pauseLabelsEnvVar ); pauseLabels != "" {
18211821 // Set labels to pause container if it's provieded as env var.
18221822 setLabelsFromJsonString (containerConfig , pauseLabels )
18231823 }
@@ -1834,7 +1834,7 @@ func (task *Task) dockerConfig(container *apicontainer.Container, apiVersion doc
18341834// Parse label string and set them to the given container configuration.
18351835func setLabelsFromJsonString (config * dockercontainer.Config , labelsString string ) {
18361836 if len (labelsString ) > 0 {
1837- labels , err := toLabelMap (labelsString )
1837+ labels , err := commonutils . JsonBlockToStringToStringMap (labelsString )
18381838 if err != nil {
18391839 log .Errorf ("Skipped setting labels because of failed to decode. Error: %s" , err )
18401840 return
@@ -1845,12 +1845,6 @@ func setLabelsFromJsonString(config *dockercontainer.Config, labelsString string
18451845 }
18461846}
18471847
1848- func toLabelMap (jsonBlock string ) (map [string ]string , error ) {
1849- out := map [string ]string {}
1850- err := json .Unmarshal ([]byte (jsonBlock ), & out )
1851- return out , err
1852- }
1853-
18541848// dockerExposedPorts returns the container ports that need to be exposed for a container
18551849// 1. For bridge-mode ServiceConnect-enabled tasks:
18561850// 1a. Pause containers need to expose the port(s) for their associated task container. In particular, SC pause container
0 commit comments