Open ghost opened 8 years ago
I found that the problem I had as passing in env variables as non-strings. I am using YAML, but the same might be the case. I had: and I changed that to:
This solved my problem with getting the error:
I hope this helps you!
We just got this issue, it's coming from the fact that the module automatically converts to integers all strings looking as an integer (see fixnumify
).
I think @garethr original idea was to prevent kubernetes errors if you setup for instance a container port to '443'
instead of 443
.
In any case, env variable value should never be fixnumified.
I push this PR which should fix the problem. May be not optimal though. Open to suggestions
When specifying a value, e.g. in 'env' block, if it is a number the module generates a malformed json.
Example:
kubernetes_pod { 'puppet-demo': ... spec => { 'containers' => [{ .... 'env' => [ { 'name' => 'MYVAR', 'value' => '1' }, ], }, }
Returns the error code:
Error: Could not set 'present' on ensure: HTTP status code 400, Pod in version "v1" cannot be handled as a Pod: [pos 301]: json: expect char '"' but got char '1' at 23:....myfile.pp Wrapped exception: Pod in version "v1" cannot be handled as a Pod: [pos 301]: json: expect char '"' but got char '1'
Note that changing the 1 to anything else non-numeric works.