cloudfoundry / cloudfoundry/cloud_controller_ng
Inconsistent manifest env JSON value error handling between cf cli v6 and v7
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 207
- Forks
- 373
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 56
Description
Please fill out the issue checklist below and provide ALL the requested information.
- [ Y ] I reviewed open and closed github issues that may be related to my problem.
- [ Y ] I tried updating to the latest version of the CF CLI to see if it fixed my problem.
- [ Y ] I attempted to run the command with
CF_TRACE=1to help debug the issue. - [ Y ] I am reporting a bug that others will be able to reproduce.
Describe the bug and the command you saw an issue with
When specifying a manifest env var with a JSON value, the value should be quoted so that it is treated as a string:
env:
JSON: '{ wasabi: { is: "good" }, i: { like: "wasabi" } }'
If the user mistakenly enters in the JSON without the quotes, a cf push using cf cli v6 will output a yaml error. However, a cf push using cf cli v7 will succeed and transform the JSON into a strange non-JSON format.
What happened
cf push v6 correctly displays an error to the user
cf push v7 succeeds but mangles the JSON
Expected behavior
I would expect the v7 push to display an error and abort the push
Exact Steps To Reproduce
Given the following manifest:
---
applications:
- name: test-app
buildpacks:
- staticfile_buildpack
env:
JSON: { wasabi: { is: "good" }, i: { like: "wasabi" } }
v6 behavior
$ cf version
cf version 6.53.0+8e2b70a4a.2020-10-01
$ cf target
api endpoint: https://api.run.nulldriver.com
api version: 2.150.0
user: admin
org: xtmp
space: xtmp
$ cf push
Pushing from manifest to org xtmp / space xtmp as admin...
Using manifest file /Users/patrickcrocker/git/cf-cli-resource/spec/fixture/static-app/manifest.yml
yaml: unmarshal errors:
line 5: cannot unmarshal !!map into string
FAILED
v7 behavior
$ cf7 version
cf7 version 7.2.0+be4a5ce2b.2020-12-10
$ cf7 target
API endpoint: https://api.run.nulldriver.com
API version: 3.85.0
user: admin
org: xtmp
space: xtmp
$ cf7 push
Pushing app test-app to org xtmp / space xtmp as admin...
Applying manifest file /Users/patrickcrocker/git/cf-cli-resource/spec/fixture/static-app/manifest.yml...
Manifest applied
Packaging files to upload...
Uploading files...
...removed for brevity...
state since cpu memory disk details
#0 running 2020-12-12T17:16:09Z 0.0% 0 of 1G 0 of 1G
$ cf env test-app
Getting env variables for app test-app in org xtmp / space xtmp as admin...
OK
System-Provided:
...removed for brevity...
User-Provided:
JSON: {:i=>{:like=>"wasabi"}, :wasabi=>{:is=>"good"}}
No running env variables have been set
No staging env variables have been set
Notice the mangled format of the JSON env variable: {:i=>{:like=>"wasabi"}, :wasabi=>{:is=>"good"}}
Provide more context
- Mac OS X 10.15.7 iTerm
Notes regarding V6 and V7 CLI support:
- V6:
- Minimum supported version of CF Deployment: v7.0.0 (CAPI Release: 1.74.0 (APIs 2.128.0 and 3.63.0))
- Maximum supported version of CF Deployment: v13.4.0 (CAPI Release: 1.94.0 (APIs 2.149.0 and 3.84.0))
- V7:
- Minimum supported version of CF Deployment: v13.5.0 (CAPI Release: 1.95.0 (APIs 2.150.0 and 3.85.0))
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the manifest env value case from the issue with cf push under CLI v7, then compare it with the v6 failure. Trace the manifest env handling used during push and verify how the unquoted mapping is converted. Done means v7 rejects the invalid value and aborts the push rather than storing the Ruby-style transformed representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100