[jbosstools-issues] [JBoss JIRA] (JBIDE-10484) When creating/editing applications/domains fails, no details about the cause are given

Andre Dietisheim (JIRA) jira-events at lists.jboss.org
Fri Feb 17 12:20:36 EST 2012


    [ https://issues.jboss.org/browse/JBIDE-10484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12668968#comment-12668968 ] 

Andre Dietisheim edited comment on JBIDE-10484 at 2/17/12 12:20 PM:
--------------------------------------------------------------------

The problem resides in the openshift-java-client. See when for instance the error occurs when creating an application and you reached the quota limit:

the server responds with:

{quote}
{"broker":"1.1.1","data":"","broker_c":["namespace","rhlogin","ssh","app_uuid","debug","alter","cartridge","cart_type","action","app_name","api"],"exit_code":1,"api_c":["placeholder"],"api":"1.1.2","messages":"OpenShift authentication will be performing maintenance on Saturday Feb 18th from 9pm til 3am.\nApplications and sites will not go down, but you will not be able to do anything that requires logging in.\n","debug":"","result":"adietish at redhat.com has already reached the application limit of 5"}
{quote}

The client library will throw a BadRequestException which occurs here - catch(HttpClientException):

OpenShiftService:
{code}
private String sendRequest(final String request, final String url, final String password, final String authKey,
		final String authIV, final String errorMessage) throws OpenShiftException {
	try {
		String requestMessage = new OpenShiftEnvelopeFactory(password, authKey, authIV, request).createString();
		String response = createHttpClient(id, url, this.doSSLChecks).post(requestMessage);
		return JsonSanitizer.sanitize(response);
	} catch (MalformedURLException e) {
		throw new OpenShiftException(e, errorMessage);
	} catch (UnauthorizedException e) {
		throw new InvalidCredentialsOpenShiftException(url, e);
	} catch (NotFoundException e) {
		throw new NotFoundOpenShiftException(url, e);
	} catch (HttpClientException e) {
		throw new OpenShiftEndpointException(url, e, errorMessage);
	}
}
{code}

The error message is given by the calling method here:

OpenShiftService:

{code}
protected IApplication requestApplicationAction(final ApplicationRequest applicationRequest, final IUser user)
	throws OpenShiftException {
	String url = applicationRequest.getUrlString(getServiceUrl());
	String request = new ApplicationRequestJsonMarshaller().marshall(applicationRequest);
	String response = sendRequest(request, url, user.getPassword(), user.getAuthKey(), user.getAuthIV(),
			MessageFormat.format("Could not {0} application \"{1}\" at \"{2}\"",
					applicationRequest.getAction().getCommand(), applicationRequest.getName(), url));
	OpenShiftResponse<IApplication> openshiftResponse =
		new ApplicationResponseUnmarshaller(applicationRequest.getName(),
				applicationRequest.getCartridge(), user, this).unmarshall(response);
	return openshiftResponse.getOpenShiftObject();
}
{code}

The reason for the failure is present in the HttpClientException that is nested into the OpenShiftEndpointException. The former would contain the full response message though which is not handy for reporting. We will have to make sure the response is unmarshalled so that one could extract the reason from OpenShiftResponse#getResult. 
                
      was (Author: adietish):
    The problem resides in the openshift-java-client. See when for instance the error occurs when creating an application and you reached the quota limit:

the server responds with:

{quote}
{"broker":"1.1.1","data":"","broker_c":["namespace","rhlogin","ssh","app_uuid","debug","alter","cartridge","cart_type","action","app_name","api"],"exit_code":1,"api_c":["placeholder"],"api":"1.1.2","messages":"OpenShift authentication will be performing maintenance on Saturday Feb 18th from 9pm til 3am.\nApplications and sites will not go down, but you will not be able to do anything that requires logging in.\n","debug":"","result":"adietish at redhat.com has already reached the application limit of 5"}
{quote}

The client library will throw a BadRequestException which occurs here - catch(HttpClientException):

OpenShiftService:
{code}
private String sendRequest(final String request, final String url, final String password, final String authKey,
		final String authIV, final String errorMessage) throws OpenShiftException {
	try {
		String requestMessage = new OpenShiftEnvelopeFactory(password, authKey, authIV, request).createString();
		String response = createHttpClient(id, url, this.doSSLChecks).post(requestMessage);
		return JsonSanitizer.sanitize(response);
	} catch (MalformedURLException e) {
		throw new OpenShiftException(e, errorMessage);
	} catch (UnauthorizedException e) {
		throw new InvalidCredentialsOpenShiftException(url, e);
	} catch (NotFoundException e) {
		throw new NotFoundOpenShiftException(url, e);
	} catch (HttpClientException e) {
		throw new OpenShiftEndpointException(url, e, errorMessage);
	}
}
{code}

The error message is given by the calling method here:

OpenShiftService:

{code}
protected IApplication requestApplicationAction(final ApplicationRequest applicationRequest, final IUser user)
	throws OpenShiftException {
	String url = applicationRequest.getUrlString(getServiceUrl());
	String request = new ApplicationRequestJsonMarshaller().marshall(applicationRequest);
	String response = sendRequest(request, url, user.getPassword(), user.getAuthKey(), user.getAuthIV(),
			MessageFormat.format("Could not {0} application \"{1}\" at \"{2}\"",
					applicationRequest.getAction().getCommand(), applicationRequest.getName(), url));
	OpenShiftResponse<IApplication> openshiftResponse =
		new ApplicationResponseUnmarshaller(applicationRequest.getName(),
				applicationRequest.getCartridge(), user, this).unmarshall(response);
	return openshiftResponse.getOpenShiftObject();
}
{code}

The reason for the failure would be actually present in OpenShiftResponse#getResult. We'd have to make sure the exception that is thrown includes the reason.
                  
> When creating/editing applications/domains fails, no details about the cause are given
> --------------------------------------------------------------------------------------
>
>                 Key: JBIDE-10484
>                 URL: https://issues.jboss.org/browse/JBIDE-10484
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: openshift
>    Affects Versions: 3.3.0.M5
>            Reporter: Andre Dietisheim
>            Assignee: Andre Dietisheim
>             Fix For: 3.3.0.Beta1
>
>         Attachments: could-not-configure.png
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list