Description of problem: if user env variable's value contain like '|',';' etc , this variable will be set to blank. Version-Release number of selected component (if applicable): devenv_3683 devenv_stage_448 How reproducible: always Steps to Reproduce: 1. creat one app 2. add one env variable with special charcter(for example '|') for this app 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 3. check its env rhc ssh app --gear env|grep special Actual results: after step 2, it will not give a response result. 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 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 103 2248 102 2248 0 19 1175 9 0:00:01 0:00:01 --:--:-- 2591 [zqzhao@dhcp-13-222 .openshift]$ rhc ssh zqphp --gear env|grep special special= Expected results: step 2: should be give a result like 'Added environment variable 'special' to application zqphp step 3: special=|/usr/bin/lesspipe.sh Additional info:
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