Description of problem: When a required parameter is missing for an application template is missing, we need to inform the user how to correct the issue. We also need to stop creating the services/routes/etc unless the entire application template can be created. Doing it the way we do leaves the system/project in a broken state. Version-Release number of selected component (if applicable): 3.0 GA How reproducible: Everytime Steps to Reproduce: 1. oc new-project thisbreak 2. oc new-app --template=jws-tomcat8-basic-sti Actual results: services/jws-app routes/jws-app-http-route imagestreams/jws-app Error: BuildConfig "jws-app" is invalid: parameters.source.git.uri: required value deploymentconfigs/jws-app Expected results: if I configuration item is missing, the new-app transaction needs to be aborted and an error message such as: Hey guy, you need to pass in a git uri parameter for this template to work. Try this command instead: oc new-app --template=jws-tomcat8-basic-sti --param=GIT_URI=https://github.com/gshipley/tomcat-openshift3.git Additional info: we give the user the missing field, but leave it up to the developer to figure out the correct naming of the field and how to fix the issue. We also leave the project in a horribly broken state in that some things were created and some were not.
Template parameters now support an optional "required" attribute. Templates should be updated to set that
The CLI should be updated to process errors from a "process template" step to tell the user which parameter had errors (the errors come back with "parameters[0]" which need to be correlated to the actual parameter name)
the error is a little better, it shows you the name of the parameter: error: error processing template test/ruby-helloworld-sample: template "ruby-helloworld-sample" is invalid: parameters: invalid value '<*>(0xc20cd4dd80)parameters[4].value: required value, Details: parameter MYSQL_DATABASE is required and must be specified', Details: failure to generate parameter value we might be able to clean that message up a little more. we're never going to do the abort/rollback proposal, you can just run the template again and it will create the things that are missing. we do not operate on a transactional model in v3.
better fix for the error message here: https://github.com/openshift/origin/pull/4641
If the template contains black value for required parameter, below error will appear when create with it with devenv-fedora-2340. [wzheng@openshiftqe test]$ oc new-app sti2.json error: error processing template bug3/ruby-helloworld-sample: template "ruby-helloworld-sample" is invalid: parameters: invalid value '{Name:MYSQL_DATABASE DisplayName: Description:database name Value: Generate: From: Required:true}', Details: template.parameters[4]: parameter MYSQL_DATABASE is required and must be specified But the original bug is about creating with invalid values which is not required parameter, like sourceURi, for if creating with blank sourceURi, the error still is not that clear like: Error: BuildConfig "jws-app" is invalid: parameters.source.git.uri: required value; can this be changed to more readable?
Ben, Wenjing so this is really about improving the error reporting from create operation where when it fails, we should give users more clean message about why it failed? The 'parameters.source.git.uri' is not a template parameter, it is BuildConfig field. So the error you seen is a validation error coming from the REST call.
michal: yes that's correct. i cleaned up the template part, but the create side logic will be harder to change.
I'm trying to find out if there's anything left to be fixed here. The introduction of the "required" flag in template parameters solved the original issue: $ oc new-app --file=https://raw.githubusercontent.com/jboss-openshift/application-templates/master/webserver/jws-tomcat8-basic-s2i.json --param SOURCE_REPOSITORY_URL="" error: error processing template demo/jws-tomcat8-basic-s2i: template "jws-tomcat8-basic-s2i" is invalid: parameters: invalid value '{Name:SOURCE_REPOSITORY_URL DisplayName: Description:Git source URI for applic ation Value: Generate: From: Required:true}', Details: template.parameters[2]: parameter SOURCE_REPOSITORY_URL is required and must be specified Now, if a template is not using a required template parameter to fill in the value of sourceURI, the current error message reads: $ oc new-app --file=t.json services/jws-app routes/jws-app imagestreams/jws-app Error: BuildConfig "jws-app" is invalid: spec.source.git.uri: required value deploymentconfigs/jws-app That's the standard validation error message returned from the REST API. Do we want to change that or anything else in the scope of this BZ?
Sounds like no, QE are you happy with the new message: Error: BuildConfig "jws-app" is invalid: spec.source.git.uri: required value deploymentconfigs/jws-app ?
OK then, I will verify this bug now.
This fix is available in OpenShift Enterprise 3.1.