@@ -759,6 +759,20 @@ func deserialiseHealtheckInstruction(data string) (string, *docker.HealthConfig,
759759 }
760760 }
761761
762+ //new param
763+ if strings .Contains (cleanInst , "--start-interval=" ) {
764+ vparts := strings .SplitN (cleanInst , "--start-interval=" , 2 )
765+ vparts = strings .SplitN (vparts [1 ], " " , 2 )
766+ val , err := time .ParseDuration (vparts [0 ])
767+ log .Debugf ("[%s] config.StartInterval %v / error = %v" , vparts [0 ], val , err )
768+ /*
769+ config.StartInterval, err = time.ParseDuration(vparts[0])
770+ if err != nil {
771+ log.Errorf("[%s] config.StartPeriod err = %v", vparts[0], err)
772+ }
773+ */
774+ }
775+
762776 if strings .Contains (cleanInst , "--retries=" ) {
763777 vparts := strings .SplitN (cleanInst , "--retries=" , 2 )
764778 vparts = strings .SplitN (vparts [1 ], " " , 2 )
@@ -817,17 +831,43 @@ func deserialiseHealtheckInstruction(data string) (string, *docker.HealthConfig,
817831 log .Errorf ("[%s] config.StartPeriod err = %v" , paramParts [2 ], err )
818832 }
819833
834+ //might have two params
835+ var rawStartInterval string
836+ var rawRetries string
837+ if strings .Contains (paramParts [3 ], " " ) {
838+ pparts := strings .SplitN (paramParts [3 ], " " , 2 )
839+ for i , p := range pparts {
840+ pparts [i ] = strings .Trim (p , "\" '" )
841+ }
842+ rawStartInterval = pparts [0 ]
843+ rawRetries = pparts [1 ]
844+ } else {
845+ rawRetries = paramParts [3 ]
846+ }
847+
848+ //new param
849+ if rawStartInterval != "" {
850+ var startInterval time.Duration
851+ //config.StartInterval
852+ startInterval , err = time .ParseDuration (rawStartInterval )
853+ if err != nil {
854+ log .Errorf ("[%s] [np] config.StartInterval err = %v" , rawStartInterval , err )
855+ }
856+
857+ log .Debugf ("[%s] config.StartInterval %v" , rawStartInterval , startInterval )
858+ }
859+
820860 var retries int64
821- if strings .Index (paramParts [ 3 ] , `\x` ) != - 1 {
861+ if strings .Index (rawRetries , `\x` ) != - 1 {
822862 // retries are hex encoded
823- retries , err = strconv .ParseInt (strings .TrimPrefix (paramParts [ 3 ] , `\x` ), 16 , 64 )
824- } else if strings .Index (paramParts [ 3 ] , `\U` ) != - 1 {
863+ retries , err = strconv .ParseInt (strings .TrimPrefix (rawRetries , `\x` ), 16 , 64 )
864+ } else if strings .Index (rawRetries , `\U` ) != - 1 {
825865 // retries are a unicode string
826- retries , err = strconv .ParseInt (strings .TrimPrefix (paramParts [ 3 ] , `\U` ), 16 , 64 )
827- } else if strings .Index (paramParts [ 3 ] , `\` ) == 0 {
866+ retries , err = strconv .ParseInt (strings .TrimPrefix (rawRetries , `\U` ), 16 , 64 )
867+ } else if strings .Index (rawRetries , `\` ) == 0 {
828868 // retries is printed as a C-escape
829- if len (paramParts [ 3 ] ) != 2 {
830- err = fmt .Errorf ("expected retries (%s) to be an escape sequence" , paramParts [ 3 ] )
869+ if len (rawRetries ) != 2 {
870+ err = fmt .Errorf ("expected retries (%s) to be an escape sequence" , rawRetries )
831871 } else {
832872 escapeCodes := map [byte ]int64 {
833873 byte ('a' ): 7 ,
@@ -839,16 +879,16 @@ func deserialiseHealtheckInstruction(data string) (string, *docker.HealthConfig,
839879 byte ('r' ): 13 ,
840880 }
841881 var ok bool
842- if retries , ok = escapeCodes [(paramParts [ 3 ] )[1 ]]; ! ok {
843- err = fmt .Errorf ("got an invalid escape sequence: %s" , paramParts [ 3 ] )
882+ if retries , ok = escapeCodes [(rawRetries )[1 ]]; ! ok {
883+ err = fmt .Errorf ("got an invalid escape sequence: %s" , rawRetries )
844884 }
845885 }
846886 } else {
847- retries = int64 ((paramParts [ 3 ] )[0 ])
887+ retries = int64 ((rawRetries )[0 ])
848888 }
849889
850890 if err != nil {
851- log .Errorf ("[%s] config.Retries err = %v" , paramParts [ 3 ] , err )
891+ log .Errorf ("[%s] config.Retries err = %v" , rawRetries , err )
852892 } else {
853893 config .Retries = int (retries )
854894 }
0 commit comments