Browse code

Merge pull request #31147 from adshmh/30629-print-escaping-hint-on-invalid-interpolation-format

docker stack deploy interpolation format error due to not escaping $ now includes a hint

Anusha Ragunathan authored on 2017/03/15 09:14:09
Showing 2 changed files
... ...
@@ -39,7 +39,7 @@ func interpolateSectionItem(
39 39
 		interpolatedValue, err := recursiveInterpolate(value, mapping)
40 40
 		if err != nil {
41 41
 			return nil, fmt.Errorf(
42
-				"Invalid interpolation format for %#v option in %s %#v: %#v",
42
+				"Invalid interpolation format for %#v option in %s %#v: %#v. You may need to escape any $ with another $.",
43 43
 				key, section, name, err.Template,
44 44
 			)
45 45
 		}
... ...
@@ -55,5 +55,5 @@ func TestInvalidInterpolation(t *testing.T) {
55 55
 		},
56 56
 	}
57 57
 	_, err := Interpolate(services, "service", defaultMapping)
58
-	assert.EqualError(t, err, `Invalid interpolation format for "image" option in service "servicea": "${"`)
58
+	assert.EqualError(t, err, `Invalid interpolation format for "image" option in service "servicea": "${". You may need to escape any $ with another $.`)
59 59
 }