Description of problem: When set customize environment ariables on OSE2.0, got "The server did not respond correctly." messages;And restapi can pass "curl -k -s -u wjiang https://10.4.59.194/broker/rest/application/52b7a4a12a165f6326000010/environment-variables -X POST -d name=key -d value=value"; But on the latest devenv(devenv_4167), the issue can not be reproduced. Version-Release number of selected component (if applicable): OSE2.0 rhc 1.19.2 How reproducible: always Steps to Reproduce: 1.Create a app 2.Try to add some customize environment variables 3. Actual results: $ rhc env set= -a ttt Setting environment variable(s) ... The server did not respond correctly. This may be an issue with the server configuration or with your connection to the server (such as a Web proxy or firewall). Please verify that you can access the OpenShift server https://10.4.59.194/broker/rest/application/52b7a4a12a165f6326000010/environment-variables And /var/log/openshift/broker/production.log: 2013-12-22 22:31:46.246 [INFO ] Started GET "/broker/rest/api" for 127.0.0.1 at 2013-12-22 22:31:46 -0500 (pid:6638) 2013-12-22 22:31:46.247 [INFO ] Processing by ApiController#show as JSON (pid:6638) 2013-12-22 22:31:46.254 [INFO ] Completed 200 OK in 6ms (Views: 3.4ms) (pid:6638) 2013-12-22 22:31:47.323 [INFO ] Started GET "/broker/rest/api" for 127.0.0.1 at 2013-12-22 22:31:47 -0500 (pid:6638) 2013-12-22 22:31:47.324 [INFO ] Processing by ApiController#show as JSON (pid:6638) 2013-12-22 22:31:47.331 [INFO ] Completed 200 OK in 6ms (Views: 3.8ms) (pid:6638) 2013-12-22 22:31:48.397 [INFO ] Started GET "/broker/rest/domains" for 127.0.0.1 at 2013-12-22 22:31:48 -0500 (pid:6638) 2013-12-22 22:31:48.398 [INFO ] Processing by DomainsController#index as JSON (pid:6638) 2013-12-22 22:31:48.416 [INFO ] Completed 200 OK in 17ms (Views: 6.7ms) (pid:6638) 2013-12-22 22:31:49.535 [INFO ] Started GET "/broker/rest/domains/amentra/applications/ttt" for 127.0.0.1 at 2013-12-22 22:31:49 -0500 (pid:6638) 2013-12-22 22:31:49.537 [INFO ] Processing by ApplicationsController#show as JSON (pid:6638) 2013-12-22 22:31:49.537 [INFO ] Parameters: {"domain_id"=>"amentra", "id"=>"ttt"} (pid:6638) 2013-12-22 22:31:49.564 [INFO ] Completed 200 OK in 27ms (Views: 8.4ms) (pid:6638) 2013-12-22 22:31:50.652 [INFO ] Started PATCH "/broker/rest/application/52b7acff2a165f0dfc00003e/environment-variables" for 127.0.0.1 at 2013-12-22 22:31:50 -0500 (pid:6638) Expected results: It should pass without any errors messages Additional info:
(In reply to weiwei jiang from comment #0) > Description of problem: > When set customize environment ariables on OSE2.0, got "The server did not > respond correctly." messages;And restapi can pass "curl -k -s -u wjiang > https://10.4.59.194/broker/rest/application/52b7a4a12a165f6326000010/ > environment-variables -X POST -d name=key -d value=value"; But on the latest > devenv(devenv_4167), the issue can not be reproduced. > > Version-Release number of selected component (if applicable): > OSE2.0 > rhc 1.19.2 > > How reproducible: > always > > Steps to Reproduce: > 1.Create a app > 2.Try to add some customize environment variables > 3. > > Actual results: > $ rhc env set= -a ttt ========> invalid rhc env set key=value -a ttt > Setting environment variable(s) ... > The server did not respond correctly. This may be an issue with the server > configuration or with your connection to the server (such as a Web proxy or > firewall). > Please verify that you can access the OpenShift server > https://10.4.59.194/broker/rest/application/52b7a4a12a165f6326000010/ > environment-variables > > And /var/log/openshift/broker/production.log: > 2013-12-22 22:31:46.246 [INFO ] Started GET "/broker/rest/api" for 127.0.0.1 > at 2013-12-22 22:31:46 -0500 (pid:6638) > 2013-12-22 22:31:46.247 [INFO ] Processing by ApiController#show as JSON > (pid:6638) > 2013-12-22 22:31:46.254 [INFO ] Completed 200 OK in 6ms (Views: 3.4ms) > (pid:6638) > 2013-12-22 22:31:47.323 [INFO ] Started GET "/broker/rest/api" for 127.0.0.1 > at 2013-12-22 22:31:47 -0500 (pid:6638) > 2013-12-22 22:31:47.324 [INFO ] Processing by ApiController#show as JSON > (pid:6638) > 2013-12-22 22:31:47.331 [INFO ] Completed 200 OK in 6ms (Views: 3.8ms) > (pid:6638) > 2013-12-22 22:31:48.397 [INFO ] Started GET "/broker/rest/domains" for > 127.0.0.1 at 2013-12-22 22:31:48 -0500 (pid:6638) > 2013-12-22 22:31:48.398 [INFO ] Processing by DomainsController#index as > JSON (pid:6638) > 2013-12-22 22:31:48.416 [INFO ] Completed 200 OK in 17ms (Views: 6.7ms) > (pid:6638) > 2013-12-22 22:31:49.535 [INFO ] Started GET > "/broker/rest/domains/amentra/applications/ttt" for 127.0.0.1 at 2013-12-22 > 22:31:49 -0500 (pid:6638) > 2013-12-22 22:31:49.537 [INFO ] Processing by ApplicationsController#show as > JSON (pid:6638) > 2013-12-22 22:31:49.537 [INFO ] Parameters: {"domain_id"=>"amentra", > "id"=>"ttt"} (pid:6638) > 2013-12-22 22:31:49.564 [INFO ] Completed 200 OK in 27ms (Views: 8.4ms) > (pid:6638) > 2013-12-22 22:31:50.652 [INFO ] Started PATCH > "/broker/rest/application/52b7acff2a165f0dfc00003e/environment-variables" > for 127.0.0.1 at 2013-12-22 22:31:50 -0500 (pid:6638) > > > Expected results: > It should pass without any errors messages > > Additional info:
When unset a variable which RESTAPI added, also got this issue.
I could not reproduce this issue. Could you please check if it happens only with an invalid command like 'rhc env set= -a ttt' or also with a valid command like 'rhc env set key=value -a ttt'? ffranz@ffranz$ rhc set-env FOO=BAR -a franzapp Setting environment variable(s) ... done ffranz@ffranz$ rhc set-env FOO2=BAR -a franzapp Setting environment variable(s) ... done ffranz@ffranz$ rhc list-env franzapp FOO=BAR FOO2=BAR ffranz@ffranz$ rhc env set FOO3=BAR3 -a franzapp Setting environment variable(s) ... done ffranz@ffranz$ rhc list-env franzapp FOO=BAR FOO2=BAR FOO3=BAR3 ffranz@ffranz$ rhc env set= -a franzapp Setting environment variable(s) ... done ffranz@ffranz$ rhc list-env franzapp FOO=BAR FOO2=BAR FOO3=BAR3 set= ffranz@ffranz$ rhc unset-env FOO3 -a franzapp Removing environment variables is a destructive operation that may result in loss of data. FOO3 Are you sure you wish to remove the environment variable(s) above from application 'franzapp'? (yes|no): y Removing environment variable(s) ... removed
Tried again and got follow result. So, maybe somethings different. [wjiang@wjiang ~]$ rhc set-env key=value -a franzapp Setting environment variable(s) ... The server did not respond correctly. This may be an issue with the server configuration or with your connection to the server (such as a Web proxy or firewall). Please verify that you can access the OpenShift server https://10.4.59.194/broker/rest/application/52c571432a165f0ab8000017/environment-variables [wjiang@wjiang ~]$ curl -k https://10.4.59.194/broker/rest/application/52c571432a165f0ab8000017/environment-variables -u wjiang:redhat {"api_version":1.6,"data":[{"links":{"GET":{"href":"https://10.4.59.194/broker/rest/application/52c571432a165f0ab8000017/environment-variable/set","method":"GET","optional_params":[],"rel":"Get environment variable","required_params":[]},"UPDATE":{"href":"https://10.4.59.194/broker/rest/application/52c571432a165f0ab8000017/environment-variable/set","method":"PUT","optional_params":[],"rel":"Update environment variable","required_params":[{"description":"Value of the environment variable","invalid_options":[],"name":"value","type":"string","valid_options":[]}]},"DELETE":{"href":"https://10.4.59.194/broker/rest/application/52c571432a165f0ab8000017/environment-variable/set","method":"DELETE","optional_params":[],"rel":"Delete environment variable","required_params":[]}},"name":"set","value":""},{"links":{"GET":{"href":"https://10.4.59.194/broker/rest/application/52c571432a165f0ab8000017/environment-variable/FOO","method":"GET","optional_params":[],"rel":"Get environment variable","required_params":[]},"UPDATE":{"href":"https://10.4.59.194/broker/rest/application/52c571432a165f0ab8000017/environment-variable/FOO","method":"PUT","optional_params":[],"rel":"Update environment variable","required_params":[{"description":"Value of the environment variable","invalid_options":[],"name":"value","type":"string","valid_options":[]}]},"DELETE":{"href":"https://10.4.59.194/broker/rest/application/52c571432a165f0ab8000017/environment-variable/FOO","method":"DELETE","optional_params":[],"rel":"Delete environment variable","required_params":[]}},"name":"FOO","value":"BAR"},{"links":{"GET":{"href":"https://10.4.59.194/broker/rest/application/52c571432a165f0ab8000017/environment-variable/FOO2","method":"GET","optional_params":[],"rel":"Get environment variable","required_params":[]},"UPDATE":{"href":"https://10.4.59.194/broker/rest/application/52c571432a165f0ab8000017/environment-variable/FOO2","method":"PUT","optional_params":[],"rel":"Update environment variable","required_params":[{"description":"Value of the environment variable","invalid_options":[],"name":"value","type":"string","valid_options":[]}]},"DELETE":{"href":"https://10.4.59.194/broker/rest/application/52c571432a165f0ab8000017/environment-variable/FOO2","method":"DELETE","optional_params":[],"rel":"Delete environment variable","required_params":[]}},"name":"FOO2","value":"BAR"}],"messages":[{"exit_code":0,"field":null,"index":null,"severity":"info","text":"Listing environment variables for application franzapp"}],"status":"ok","supported_api_versions":[1.0,1.1,1.2,1.3,1.4,1.5,1.6],"type":"environment-variables","version":"1.6"}
Couldn't really reproduce this. Could you confirm it's not related to proxy (check your http_proxy and https_proxy env vars)? curl will not pass through it while rhc will always use the proxy defined in those env vars.
Tried with Ose-2.0.2 with rhc-1.19.3 again, and still can reproduce, and found the issue is OSE-2.0.2 can not response PATCH method http request. when I set a environment variable on ose-2.0.2 with rhc-1.19.3, found it is using PATCH method even the output display server can hold restapi 1.6 $ rhc env set key=value -a app -d DEBUG: Using config file /home/wjiang/.openshift/express.conf DEBUG: Git config 'git config --get rhc.app-id' returned '' DEBUG: Git config 'git config --get rhc.app-name' returned '' DEBUG: Git config 'git config --get rhc.domain-name' returned '' DEBUG: Authenticating with RHC::Auth::Token DEBUG: Connecting to https://10.4.59.138/broker/rest/api DEBUG: Getting all domains DEBUG: Client supports API versions 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 DEBUG: Using token authentication DEBUG: Created new httpclient DEBUG: Request GET https://10.4.59.138/broker/rest/api DEBUG: SSL Verification failed -- Using self signed cert DEBUG: code 200 5957 ms DEBUG: Server supports API versions 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 DEBUG: Using API version 1.6 DEBUG: Client API version 1.6 is not current. Refetching API DEBUG: Using token authentication DEBUG: Request GET https://10.4.59.138/broker/rest/api DEBUG: SSL Verification failed -- Using self signed cert DEBUG: code 200 4154 ms DEBUG: Using token authentication DEBUG: Request GET https://10.4.59.138/broker/rest/domains DEBUG: SSL Verification failed -- Using self signed cert DEBUG: code 200 1891 ms DEBUG: Using token authentication DEBUG: Request GET https://10.4.59.138/broker/rest/domains/wjiang/applications/app DEBUG: SSL Verification failed -- Using self signed cert DEBUG: code 200 2398 ms Setting environment variable(s) ... DEBUG: Adding environment variable(s) [#<RHC::Rest::EnvironmentVariable:0x00000002b377a0 @attributes={"name"=>"key", "value"=>"value", "messages"=>[]}, @client=nil>] for app DEBUG: Using token authentication DEBUG: Request PATCH https://10.4.59.138/broker/rest/application/52d746d2ea28b97040000013/environment-variables DEBUG: SSL Verification failed -- Using self signed cert DEBUG: code 500 1782 ms DEBUG: Response did not include a message from server: invalid character at "<!DOCTYPE " The server did not respond correctly. This may be an issue with the server configuration or with your connection to the server (such as a Web proxy or firewall). Please verify that you can access the OpenShift server https://10.4.59.138/broker/rest/application/52d746d2ea28b97040000013/environment-variables And when use restapi to do the same PATCH request $ curl -k -u wjiang:redhat https://10.4.59.138/broker/rest/application/52d746d2ea28b97040000013/environment-variables --data-urlencode name=asdfsdfa --data-urlencode value=asdfsadfsaf -X PATCH <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>500 Internal Server Error</title> </head><body> <h1>Internal Server Error</h1> <p>The server encountered an internal error or misconfiguration and was unable to complete your request.</p> <p>Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.</p> <p>More information about this error may be available in the server error log.</p> <hr> <address>Apache/2.2.15 (Red Hat) Server at 10.4.59.138 Port 80</address> </body></html> So, it show the server can not response the request which with PATCH method.
And the same result with rhc-1.19.4
Patch support was added to the broker in https://bugzilla.redhat.com/show_bug.cgi?id=1039760 Probably needs to be backported to OSE
Broker needs to support env var API with PATCH HTTP method, since that is what is published in the API. Upstream fix made in https://github.com/openshift/origin-server/commit/fe197de3
verify this bug with rubygem-openshift-origin-controller-1.17.12-1.el6op using PACTH method to add customize environment variables to app: [root@broker ~]# curl -k -H 'Accept: application/xml' --user gpei:redhat https:/ /broker.ose-0116.com/broker/rest/application/52e71c960ca8746a8b000017/environmen t-variables --data-urlencode name=asdfsdfa --data-urlencode value=asdfsadfsaf -X PATCH <?xml version="1.0" encoding="UTF-8"?> <response> <status>created</status> <type>environment-variable</type> <data> <environment-variable> <name>asdfsdfa</name> <value>asdfsadfsaf</value> <links> <link> <rel>Get environment variable</rel> <method>GET</method> <href>https://broker.ose-0116.com/broker/rest/application/52e71c960ca8 746a8b000017/environment-variable/asdfsdfa</href> <required-params/> <optional-params/> </link> <link> <rel>Update environment variable</rel> <method>PUT</method> <href>https://broker.ose-0116.com/broker/rest/application/52e71c960ca8 746a8b000017/environment-variable/asdfsdfa</href> <required-params> <param> <name>value</name> <type>string</type> <description>Value of the environment variable</description> <valid-options/> <invalid-options/> </param> </required-params> <optional-params/> </link> <link> <rel>Delete environment variable</rel> <method>DELETE</method> <href>https://broker.ose-0116.com/broker/rest/application/52e71c960ca8 746a8b000017/environment-variable/asdfsdfa</href> <required-params/> <optional-params/> </link> </links> </environment-variable> </data> <messages> <message> <severity>info</severity> <text>Added environment variable 'asdfsdfa' to application app1</text> <exit-code>0</exit-code> <field nil="true"></field> <index nil="true"></index> </message> </messages> <version>1.6</version> <api-version>1.6</api-version> <supported-api-versions> <supported-api-version>1.0</supported-api-version> <supported-api-version>1.1</supported-api-version> <supported-api-version>1.2</supported-api-version> <supported-api-version>1.3</supported-api-version> <supported-api-version>1.4</supported-api-version> <supported-api-version>1.5</supported-api-version> <supported-api-version>1.6</supported-api-version> </supported-api-versions> </response>
verified with puddle-2-0-3-2014-01-27
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2014-0117.html