[root@ip-10-73-193-147 ~]# curl -k --user 'user:nopass' https://localhost/broker/rest/application/52a62d954950ead54b00004b/environment-variables -X PATCH -d environment_variables[][name]=FOO -d environment_variables[][name]=BAR -d environment_variables[][value]=updated -d environment_variables[][name]=NEW -d environment_variables[][value]='new var' <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Action Controller: Exception caught</title> <style> body { background-color: #fff; color: #333; } body, p, ol, ul, td { font-family: helvetica, verdana, arial, sans-serif; font-size: 13px; line-height: 18px; } pre { background-color: #eee; padding: 10px; font-size: 11px; white-space: pre-wrap; } a { color: #000; } a:visited { color: #666; } a:hover { color: #fff; background-color:#000; } </style> </head> <body> <h1>Routing Error</h1> <p><pre>No route matches [PATCH] "/broker/rest/application/52a62d954950ead54b00004b/environment-variables"</pre></p> <p> Try running <code>rake routes</code> for more information on available routes. </p> </body> </html>
Decide whether to support POST or PATCH for adding multiple env vars (a) For PATCH - Fix broker REST api (currently showing routing error) - Fix CLI tools(rhc) to use PATCH method for adding multiple env vars. (b) For POST - Fix rest application link method, change from PATCH to POST.
RHC isn't using PATCH because it's set to version 1.5. The 1.5 API returns POST for the env var methods. That's fine for now, we can bump the API version of RHC separately. Created PR https://github.com/openshift/origin-server/pull/4311 which adds PATCH support, mapping it to #create (just like POST).
STG pull of https://github.com/openshift/origin-server/pull/4314
Verified on devenv-stage_609 and STG(devenv-stage_609). # curl -k --user lxia https://localhost/broker/rest/application/52a816c830f2c8a076000007/environment-variables -X PATCH -d environment_variables[][name]=FOO -d environment_variables[][name]=BAR -d environment_variables[][value]=updated -d environment_variables[][name]=NEW -d environment_variables[][value]='new var' {"api_version":1.6,"data":[{"links":{"GET":{"href":"https://localhost/broker/rest/application/52a816c830f2c8a076000007/environment-variable/BAR","method":"GET","optional_params":[],"rel":"Get environment variable","required_params":[]},"UPDATE":{"href":"https://localhost/broker/rest/application/52a816c830f2c8a076000007/environment-variable/BAR","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://localhost/broker/rest/application/52a816c830f2c8a076000007/environment-variable/BAR","method":"DELETE","optional_params":[],"rel":"Delete environment variable","required_params":[]}},"name":"BAR","value":"updated"},{"links":{"GET":{"href":"https://localhost/broker/rest/application/52a816c830f2c8a076000007/environment-variable/NEW","method":"GET","optional_params":[],"rel":"Get environment variable","required_params":[]},"UPDATE":{"href":"https://localhost/broker/rest/application/52a816c830f2c8a076000007/environment-variable/NEW","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://localhost/broker/rest/application/52a816c830f2c8a076000007/environment-variable/NEW","method":"DELETE","optional_params":[],"rel":"Delete environment variable","required_params":[]}},"name":"NEW","value":"new var"}],"messages":[{"exit_code":0,"field":null,"index":null,"severity":"info","text":"Patched environment variables for application app"}],"status":"created","supported_api_versions":[1.0,1.1,1.2,1.3,1.4,1.5,1.6],"type":"environment-variables","version":"1.6"} # curl -k --user 'lxia+migrate' https://stg.openshift.redhat.com/broker/rest/application/52972ba7dbd93c4dd6000252/environment-variables -X PATCH -d environment_variables[][name]=FOO -d environment_variables[][name]=BAR -d environment_variables[][value]=updated -d environment_variables[][name]=NEW -d environment_variables[][value]='new var' Enter host password for user 'lxia+migrate': {"api_version":1.6,"data":[{"links":{"GET":{"href":"https://stg.openshift.redhat.com/broker/rest/application/52972ba7dbd93c4dd6000252/environment-variable/BAR","method":"GET","optional_params":[],"rel":"Get environment variable","required_params":[]},"UPDATE":{"href":"https://stg.openshift.redhat.com/broker/rest/application/52972ba7dbd93c4dd6000252/environment-variable/BAR","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://stg.openshift.redhat.com/broker/rest/application/52972ba7dbd93c4dd6000252/environment-variable/BAR","method":"DELETE","optional_params":[],"rel":"Delete environment variable","required_params":[]}},"name":"BAR","value":"updated"},{"links":{"GET":{"href":"https://stg.openshift.redhat.com/broker/rest/application/52972ba7dbd93c4dd6000252/environment-variable/NEW","method":"GET","optional_params":[],"rel":"Get environment variable","required_params":[]},"UPDATE":{"href":"https://stg.openshift.redhat.com/broker/rest/application/52972ba7dbd93c4dd6000252/environment-variable/NEW","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://stg.openshift.redhat.com/broker/rest/application/52972ba7dbd93c4dd6000252/environment-variable/NEW","method":"DELETE","optional_params":[],"rel":"Delete environment variable","required_params":[]}},"name":"NEW","value":"new var"}],"messages":[{"exit_code":0,"field":null,"index":null,"severity":"info","text":"Patched environment variables for application diy"}],"status":"created","supported_api_versions":[1.0,1.1,1.2,1.3,1.4,1.5,1.6],"type":"environment-variables","version":"1.6"}
Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/fe197de3e056e9d71df9891a4c15c0d894c90136 Fix bug 1039760: Add patch support for env vars
Verified on devenv_4125. # curl -k --user lxia https://localhost/broker/rest/application/52a94d348cdc1fe434000084/environment-variables -X PATCH -d environment_variables[][name]=FOO -d environment_variables[][name]=BAR -d environment_variables[][value]=updated -d environment_variables[][name]=NEW -d environment_variables[][value]='new var' Enter host password for user 'lxia': {"api_version":1.6,"data":[{"links":{"GET":{"href":"https://localhost/broker/rest/application/52a94d348cdc1fe434000084/environment-variable/BAR","method":"GET","optional_params":[],"rel":"Get environment variable","required_params":[]},"UPDATE":{"href":"https://localhost/broker/rest/application/52a94d348cdc1fe434000084/environment-variable/BAR","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://localhost/broker/rest/application/52a94d348cdc1fe434000084/environment-variable/BAR","method":"DELETE","optional_params":[],"rel":"Delete environment variable","required_params":[]}},"name":"BAR","value":"updated"},{"links":{"GET":{"href":"https://localhost/broker/rest/application/52a94d348cdc1fe434000084/environment-variable/NEW","method":"GET","optional_params":[],"rel":"Get environment variable","required_params":[]},"UPDATE":{"href":"https://localhost/broker/rest/application/52a94d348cdc1fe434000084/environment-variable/NEW","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://localhost/broker/rest/application/52a94d348cdc1fe434000084/environment-variable/NEW","method":"DELETE","optional_params":[],"rel":"Delete environment variable","required_params":[]}},"name":"NEW","value":"new var"}],"messages":[{"exit_code":0,"field":null,"index":null,"severity":"info","text":"Patched environment variables for application diy"}],"status":"created","supported_api_versions":[1.0,1.1,1.2,1.3,1.4,1.5,1.6],"type":"environment-variables","version":"1.6"}