Bug 999770
Summary: | [origin_broker_86] User Env variable's value still cannot support special chars like '%' , ';' | ||
---|---|---|---|
Product: | OpenShift Online | Reporter: | zhaozhanqi <zzhao> |
Component: | Master | Assignee: | Ben Parees <bparees> |
Status: | CLOSED NOTABUG | QA Contact: | libra bugs <libra-bugs> |
Severity: | low | Docs Contact: | |
Priority: | medium | ||
Version: | 2.x | CC: | bparees, xtian |
Target Milestone: | --- | Keywords: | Reopened |
Target Release: | --- | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2013-11-15 21:17:17 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
zhaozhanqi
2013-08-22 05:34:54 UTC
Ravi, let me know if you need help with bug fixes This is expected behavior. Step-2 is interpreted by bash shell as (a) curl -k -H 'Accept: application/xml' --user zzhao:redhat https://$instance/broker/rest/applications/479428171624072284733440/environment-variables -X POST -d name=special -d value= (b) Output of (a) will be passed to /usr/bin/lesspipe.sh because of '|' What you might have intended was to do this: curl -k -H 'Accept: application/xml' --user zzhao:redhat https://$instance/broker/rest/applications/479428171624072284733440/environment-variables -X POST -d name=special -d value='|/usr/bin/lesspipe.sh' => this works. Note: single quotes ('') was missing for the value param. RE-open this bug, ';' '%' still cannot be parsed 1)curl -k -H 'Accept: application/xml' --user zzhao:redhat https://$instance/broker/rest/applications/8ab67c8c0b9811e3928e22000ab227cc/environment-variables/foo -X PUT -d value='rs=0:di=01;34:ln=01' $ rhc ssh zqphp --gear env |grep foo foo=rs=0:di=01 2)curl -k -H 'Accept: application/xml' --user zzhao:redhat https://$instance/broker/rest/applications/8ab67c8c0b9811e3928e22000ab227cc/environment-variables/foo -X PUT -d value='|/usr/bin/lesspipe.sh %s' it will return errors '<h1> ArgumentError in EnvironmentVariablesController#update </h1> <pre>invalid %-encoding (|/usr/bin/lesspipe.sh %s)</pre>' FIY: the following env variable are got from 'env', so we need to support this situation. LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;0 LESSOPEN=|/usr/bin/lesspipe.sh %s ; and % are special characters in html form posting (which is the format you're using with the -d curl commands) so you'd need to escape them, eg: curl -k -H 'Accept: application/xml' --user test:test https://ec2-54-205-123-138.compute-1.amazonaws.com/broker/rest/domain/test/application/jbossews/environment-variables -X POST -d name=foo8 -d value='bar%3B' yields: rhc ssh jbossews --gear env | grep foo8 foo8=bar; and curl -k -H 'Accept: application/xml' --user test:test https://ec2-54-205-123-138.compute-1.amazonaws.com/broker/rest/domain/test/application/jbossews/environment-variables -X POST -d name=foo9 -d value='bar%25' yields rhc ssh jbossews --gear env | grep foo9 foo9=bar% Note that I also tested the rhc commands directly and they handle the escaping for you (well they appear to use json so html form encoding is not an issue): rhc env set test=test%test --app jbossews Setting environment variable(s) ... done rhc env show test --app jbossews test=test%test # note in this case i had to quote the value to avoid the shell processing the ; rhc env set test='test;test' --app jbossews Setting environment variable(s) ... done rhc env show test --app jbossews test=test;test |