Bug 1053471
Summary: | Fail to parse the env vars of an array of hashes when setting multiple env vars in one API call using SET_UNSET_ENVIRONMENT_VARIABLES, ADD_CARTRIDGE, or ADD_APPLICATION APIs | ||
---|---|---|---|
Product: | OpenShift Online | Reporter: | Zhe Wang <zhewang> |
Component: | Master | Assignee: | Lili Nader <lnader> |
Status: | CLOSED NOTABUG | QA Contact: | libra bugs <libra-bugs> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 2.x | CC: | ccoleman, mfisher, xtian |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2014-01-15 19:43:48 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Zhe Wang
2014-01-15 10:15:32 UTC
Similar problem also exists in the following APIs: ADD_APPLICATION (with multiple env vars) e.g., curl -k -u user:password https://<BROKER_DNS>/broker/rest/domain/stg621/applications -XPOST -d name=py273 -d cartridges[][name]=python-2.7 -d environment_variables=[{'name':'FOO', 'value':'123'}, {'name':'BAR', 'value':'abc'}] | python -m json.tool ADD_CARTRIDGE (with multiple env vars): e.g., curl -k -u user:password https://<BROKER_DNS>/broker/rest/application/52d635f96993b9bb88000007/cartridges -d name=mongodb-2.2 -d environment_variables="[{'name':'FOO', 'value':'123'}, {'name':'BAR', 'value':'abc'}]" | python -m json.tool I also tried with the following format, but none of these succeeded. Maybe we need to change the type of environment_variables to string, or change the description somehow. 1. without white spaces in the value of environment_variables -d environment_variables=[{'name':'BAR','value':'123'},{'name':'FOO','value':'abc'}] curl -k -u user:password https://<BROKER>/broker/rest/application/52d68ddd819d378008000007/environment-variables -d environment_variables=[{'name':'BAR', 'value':'123'},{'name':'FOO', 'value':'abc'}] -XPATCH | python -m json.tool 2. -d environment_variables[]=[{'name':'BAR', 'value':'123'},{'name':'FOO', 'value':'abc'}] 3. -d environment_variables[0]={'name':'BAR', 'value':'123'} 4. using escaping chars -d environment_variables=\[\{\'name\'\:\'BAR\'\,\'value\'\:\'123\'\}\,\{\'name\'\:\'FOO\'\,\'value\'\:\'abc\'\}\] 5. using a json obj: {'environment_variables': [{'name':'BAR','value':'123'},{'name':'FOO','value':'abc'}]} You have to post as valid JSON curl -X PATCH -H "Content-Type: application/json" -d "{'environment_variables': [{'name':'BAR','value':'123'},{'name':'FOO','value':'abc'}]}" That works for me. -d environment_variables=[...] is not a valid JSON document, you'd have to be using: environment_variables[][name]=a&environment_variables[][value]=b&.... |