mirror of https://github.com/apache/jclouds.git
Merge branch 'master' of git://github.com/jclouds/jclouds
This commit is contained in:
commit
4f83c7dc1e
|
@ -64,44 +64,51 @@ public class ParseAtmosStorageErrorFromXmlContent implements HttpErrorHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Pattern DIRECTORY_PATH = Pattern.compile("^/rest/namespace/?([^/]+)/$");
|
public static final Pattern DIRECTORY_PATH = Pattern.compile("^/rest/namespace/?([^/]+)/$");
|
||||||
public static final Pattern DIRECTORY_KEY_PATH = Pattern
|
public static final Pattern DIRECTORY_KEY_PATH = Pattern.compile("^/rest/namespace/?([^/]+)/(.*)");
|
||||||
.compile("^/rest/namespace/?([^/]+)/(.*)");
|
|
||||||
|
|
||||||
public void handleError(HttpCommand command, HttpResponse response) {
|
public void handleError(HttpCommand command, HttpResponse response) {
|
||||||
Exception exception = new HttpResponseException(command, response);
|
Exception exception = new HttpResponseException(command, response);
|
||||||
try {
|
try {
|
||||||
AtmosStorageError error = parseErrorFromContentOrNull(command, response);
|
AtmosStorageError error = null;
|
||||||
|
if (response.getPayload() != null) {
|
||||||
|
try {
|
||||||
|
String content = Utils.toStringAndClose(response.getPayload().getInput());
|
||||||
|
if (content != null && content.indexOf('<') >= 0) {
|
||||||
|
error = utils.parseAtmosStorageErrorFromContent(command, response, Utils.toInputStream(content));
|
||||||
|
} else {
|
||||||
|
exception = content != null ? new HttpResponseException(command, response, content) : exception;
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.warn(e, "exception reading error from response", response);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (error != null && error.getCode() == 1016) {
|
if (error != null && error.getCode() == 1016) {
|
||||||
File file = new File(command.getRequest().getEndpoint().getPath());
|
File file = new File(command.getRequest().getEndpoint().getPath());
|
||||||
exception = new KeyAlreadyExistsException(file.getParentFile().getAbsolutePath(), file
|
exception = new KeyAlreadyExistsException(file.getParentFile().getAbsolutePath(), file.getName());
|
||||||
.getName());
|
|
||||||
} else {
|
} else {
|
||||||
switch (response.getStatusCode()) {
|
switch (response.getStatusCode()) {
|
||||||
case 401:
|
case 401:
|
||||||
exception = new AuthorizationException(command.getRequest(),
|
exception = new AuthorizationException(exception.getMessage(), exception);
|
||||||
error != null ? error.getMessage() : response.getStatusLine());
|
break;
|
||||||
break;
|
case 404:
|
||||||
case 404:
|
if (!command.getRequest().getMethod().equals("DELETE")) {
|
||||||
if (!command.getRequest().getMethod().equals("DELETE")) {
|
String message = error != null ? error.getMessage() : String.format("%s -> %s", command.getRequest()
|
||||||
String message = error != null ? error.getMessage() : String.format(
|
.getRequestLine(), response.getStatusLine());
|
||||||
"%s -> %s", command.getRequest().getRequestLine(), response
|
String path = command.getRequest().getEndpoint().getPath();
|
||||||
.getStatusLine());
|
Matcher matcher = DIRECTORY_PATH.matcher(path);
|
||||||
String path = command.getRequest().getEndpoint().getPath();
|
if (matcher.find()) {
|
||||||
Matcher matcher = DIRECTORY_PATH.matcher(path);
|
exception = new ContainerNotFoundException(matcher.group(1), message);
|
||||||
|
} else {
|
||||||
|
matcher = DIRECTORY_KEY_PATH.matcher(path);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
exception = new ContainerNotFoundException(matcher.group(1), message);
|
exception = new KeyNotFoundException(matcher.group(1), matcher.group(2), message);
|
||||||
} else {
|
|
||||||
matcher = DIRECTORY_KEY_PATH.matcher(path);
|
|
||||||
if (matcher.find()) {
|
|
||||||
exception = new KeyNotFoundException(matcher.group(1), matcher.group(2),
|
|
||||||
message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
break;
|
||||||
exception = error != null ? new AtmosStorageResponseException(command, response,
|
default:
|
||||||
error) : new HttpResponseException(command, response);
|
exception = error != null ? new AtmosStorageResponseException(command, response, error)
|
||||||
|
: new HttpResponseException(command, response);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,17 +118,4 @@ public class ParseAtmosStorageErrorFromXmlContent implements HttpErrorHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AtmosStorageError parseErrorFromContentOrNull(HttpCommand command, HttpResponse response) {
|
|
||||||
if (response.getPayload() != null) {
|
|
||||||
try {
|
|
||||||
String content = Utils.toStringAndClose(response.getPayload().getInput());
|
|
||||||
if (content != null && content.indexOf('<') >= 0)
|
|
||||||
return utils.parseAtmosStorageErrorFromContent(command, response, Utils
|
|
||||||
.toInputStream(content));
|
|
||||||
} catch (IOException e) {
|
|
||||||
logger.warn(e, "exception reading error from response", response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -66,7 +66,7 @@ public class ParseAWSErrorFromXmlContent implements HttpErrorHandler {
|
||||||
|
|
||||||
public void handleError(HttpCommand command, HttpResponse response) {
|
public void handleError(HttpCommand command, HttpResponse response) {
|
||||||
HttpRequest request = command.getRequest();
|
HttpRequest request = command.getRequest();
|
||||||
Exception exception = null;
|
Exception exception = new HttpResponseException(command, response);
|
||||||
try {
|
try {
|
||||||
AWSError error = null;
|
AWSError error = null;
|
||||||
String message = null;
|
String message = null;
|
||||||
|
@ -81,14 +81,13 @@ public class ParseAWSErrorFromXmlContent implements HttpErrorHandler {
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
message = Utils.toStringAndClose(response.getPayload().getInput());
|
message = Utils.toStringAndClose(response.getPayload().getInput());
|
||||||
|
exception = new HttpResponseException(command, response, message);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
message = message != null ? message : String.format("%s -> %s", request.getRequestLine(),
|
message = message != null ? message : String.format("%s -> %s", request.getRequestLine(),
|
||||||
response.getStatusLine());
|
response.getStatusLine());
|
||||||
if (exception == null)
|
|
||||||
exception = new HttpResponseException(command, response, message);
|
|
||||||
switch (response.getStatusCode()) {
|
switch (response.getStatusCode()) {
|
||||||
case 400:
|
case 400:
|
||||||
if (error != null && error.getCode() != null
|
if (error != null && error.getCode() != null
|
||||||
|
@ -98,13 +97,13 @@ public class ParseAWSErrorFromXmlContent implements HttpErrorHandler {
|
||||||
.getCode().endsWith(".Duplicate"))) || (message != null && message.indexOf("already exists") != -1))
|
.getCode().endsWith(".Duplicate"))) || (message != null && message.indexOf("already exists") != -1))
|
||||||
exception = new IllegalStateException(message, exception);
|
exception = new IllegalStateException(message, exception);
|
||||||
else if (error != null && error.getCode() != null && error.getCode().equals("AuthFailure"))
|
else if (error != null && error.getCode() != null && error.getCode().equals("AuthFailure"))
|
||||||
exception = new AuthorizationException(command.getRequest(), message);
|
exception = new AuthorizationException(exception.getMessage(), exception);
|
||||||
else if (message != null && message.indexOf("Failed to bind the following fields") != -1)// Nova
|
else if (message != null && message.indexOf("Failed to bind the following fields") != -1)// Nova
|
||||||
exception = new IllegalArgumentException(message, exception);
|
exception = new IllegalArgumentException(message, exception);
|
||||||
break;
|
break;
|
||||||
case 401:
|
case 401:
|
||||||
case 403:
|
case 403:
|
||||||
exception = new AuthorizationException(command.getRequest(), message);
|
exception = new AuthorizationException(exception.getMessage(), exception);
|
||||||
break;
|
break;
|
||||||
case 404:
|
case 404:
|
||||||
if (!command.getRequest().getMethod().equals("DELETE")) {
|
if (!command.getRequest().getMethod().equals("DELETE")) {
|
||||||
|
|
|
@ -80,12 +80,14 @@ public class ParseAzureStorageErrorFromXmlContent implements HttpErrorHandler {
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
try {
|
try {
|
||||||
message = Utils.toStringAndClose(response.getPayload().getInput());
|
message = Utils.toStringAndClose(response.getPayload().getInput());
|
||||||
|
exception = new HttpResponseException(command, response, message);
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
message = Utils.toStringAndClose(response.getPayload().getInput());
|
message = Utils.toStringAndClose(response.getPayload().getInput());
|
||||||
|
exception = new HttpResponseException(command, response, message);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +96,7 @@ public class ParseAzureStorageErrorFromXmlContent implements HttpErrorHandler {
|
||||||
response.getStatusLine());
|
response.getStatusLine());
|
||||||
switch (response.getStatusCode()) {
|
switch (response.getStatusCode()) {
|
||||||
case 401:
|
case 401:
|
||||||
exception = new AuthorizationException(command.getRequest(), message);
|
exception = new AuthorizationException(exception.getMessage(), exception);
|
||||||
break;
|
break;
|
||||||
case 404:
|
case 404:
|
||||||
if (!command.getRequest().getMethod().equals("DELETE")) {
|
if (!command.getRequest().getMethod().equals("DELETE")) {
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package org.jclouds.rest;
|
package org.jclouds.rest;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when there is an authorization error.
|
* Thrown when there is an authorization error.
|
||||||
|
@ -39,14 +38,6 @@ public class AuthorizationException extends RuntimeException {
|
||||||
super(arg0, arg1);
|
super(arg0, arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuthorizationException(HttpRequest resource, String error) {
|
|
||||||
super(String.format("%s -> %s", resource.getRequestLine(), error));
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthorizationException(HttpRequest resource, String error, Throwable arg1) {
|
|
||||||
super(String.format("%s -> %s", resource.getRequestLine(), error), arg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthorizationException(Throwable arg0) {
|
public AuthorizationException(Throwable arg0) {
|
||||||
super(arg0);
|
super(arg0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,23 +53,17 @@ public class GoGridErrorHandler implements HttpErrorHandler {
|
||||||
try {
|
try {
|
||||||
Exception exception = new HttpResponseException(command, response);
|
Exception exception = new HttpResponseException(command, response);
|
||||||
Set<ErrorResponse> errors = parseErrorsFromContentOrNull(response);
|
Set<ErrorResponse> errors = parseErrorsFromContentOrNull(response);
|
||||||
|
if (errors != null)
|
||||||
|
exception = new GoGridResponseException(command, response, errors);
|
||||||
switch (response.getStatusCode()) {
|
switch (response.getStatusCode()) {
|
||||||
case 400:
|
case 400:
|
||||||
if (Iterables.get(errors, 0).getMessage()
|
if (Iterables.get(errors, 0).getMessage().indexOf("No object found") != -1) {
|
||||||
.indexOf("No object found") != -1) {
|
exception = new ResourceNotFoundException(Iterables.get(errors, 0).getMessage(), exception);
|
||||||
exception = new ResourceNotFoundException(Iterables.get(errors,
|
|
||||||
0).getMessage(), exception);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 403:
|
case 403:
|
||||||
|
exception = new AuthorizationException(exception.getMessage(), exception);
|
||||||
exception = new AuthorizationException(command.getRequest(),
|
|
||||||
errors != null ? errors.toString() : response.getStatusLine());
|
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
exception = errors != null ? new GoGridResponseException(command,
|
|
||||||
response, errors) : new HttpResponseException(command,
|
|
||||||
response);
|
|
||||||
}
|
}
|
||||||
command.setException(exception);
|
command.setException(exception);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class ParseCloudFilesErrorFromHttpResponse implements HttpErrorHandler {
|
||||||
exception = content != null ? new HttpResponseException(command, response, content) : exception;
|
exception = content != null ? new HttpResponseException(command, response, content) : exception;
|
||||||
switch (response.getStatusCode()) {
|
switch (response.getStatusCode()) {
|
||||||
case 401:
|
case 401:
|
||||||
exception = new AuthorizationException(command.getRequest(), content, exception);
|
exception = new AuthorizationException(exception.getMessage(), exception);
|
||||||
break;
|
break;
|
||||||
case 404:
|
case 404:
|
||||||
if (!command.getRequest().getMethod().equals("DELETE")) {
|
if (!command.getRequest().getMethod().equals("DELETE")) {
|
||||||
|
|
|
@ -52,9 +52,10 @@ public class ParseCloudServersErrorFromHttpResponse implements HttpErrorHandler
|
||||||
Exception exception = new HttpResponseException(command, response);
|
Exception exception = new HttpResponseException(command, response);
|
||||||
try {
|
try {
|
||||||
String content = parseErrorFromContentOrNull(command, response);
|
String content = parseErrorFromContentOrNull(command, response);
|
||||||
|
exception = content != null ? new HttpResponseException(command, response, content) : exception;
|
||||||
switch (response.getStatusCode()) {
|
switch (response.getStatusCode()) {
|
||||||
case 401:
|
case 401:
|
||||||
exception = new AuthorizationException(command.getRequest(), content);
|
exception = new AuthorizationException(exception.getMessage(), exception);
|
||||||
break;
|
break;
|
||||||
case 404:
|
case 404:
|
||||||
if (!command.getRequest().getMethod().equals("DELETE")) {
|
if (!command.getRequest().getMethod().equals("DELETE")) {
|
||||||
|
|
|
@ -64,8 +64,8 @@ public class ParseRimuHostingException implements Function<Exception, Object> {
|
||||||
RimuHostingResponse firstResponse = Iterables.get(responseMap.values(), 0);
|
RimuHostingResponse firstResponse = Iterables.get(responseMap.values(), 0);
|
||||||
String errorClass = firstResponse.getErrorInfo().getErrorClass();
|
String errorClass = firstResponse.getErrorInfo().getErrorClass();
|
||||||
if (errorClass.equals("PermissionException"))
|
if (errorClass.equals("PermissionException"))
|
||||||
throw new AuthorizationException(responseException.getCommand().getRequest(),
|
throw new AuthorizationException(
|
||||||
firstResponse.getErrorInfo().getErrorMessage());
|
firstResponse.getErrorInfo().getErrorMessage(), responseException);
|
||||||
throw new RuntimeException(firstResponse.getErrorInfo().getErrorMessage(), e);
|
throw new RuntimeException(firstResponse.getErrorInfo().getErrorMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
echo log_level :info>>c:\etc\chef\client.rb
|
echo log_level :info>>c:\etc\chef\client.rb
|
||||||
echo log_location STDOUT>>c:\etc\chef\client.rb
|
echo log_location STDOUT>>c:\etc\chef\client.rb
|
||||||
echo chef_server_url "http://localhost:4000">>c:\etc\chef\client.rb
|
echo chef_server_url "http://localhost:4000">>c:\etc\chef\client.rb
|
||||||
|
|
|
@ -1,134 +1,134 @@
|
||||||
@echo off
|
@echo off
|
||||||
set PATH=
|
set PATH=
|
||||||
set JAVA_HOME=
|
set JAVA_HOME=
|
||||||
set PATH=
|
set PATH=
|
||||||
GOTO FUNCTION_END
|
GOTO FUNCTION_END
|
||||||
:abort
|
:abort
|
||||||
echo aborting: %EXCEPTION%
|
echo aborting: %EXCEPTION%
|
||||||
exit /b 1
|
exit /b 1
|
||||||
:default
|
:default
|
||||||
set INSTANCE_NAME=mkebsboot
|
set INSTANCE_NAME=mkebsboot
|
||||||
set INSTANCE_HOME=/mnt/tmp
|
set INSTANCE_HOME=/mnt/tmp
|
||||||
set LOG_DIR=/mnt/tmp
|
set LOG_DIR=/mnt/tmp
|
||||||
exit /b 0
|
exit /b 0
|
||||||
:mkebsboot
|
:mkebsboot
|
||||||
set TMP_DIR=/mnt/tmp
|
set TMP_DIR=/mnt/tmp
|
||||||
exit /b 0
|
exit /b 0
|
||||||
:findPid
|
:findPid
|
||||||
set FOUND_PID=
|
set FOUND_PID=
|
||||||
set _expression=%1
|
set _expression=%1
|
||||||
shift
|
shift
|
||||||
set FIND_PROCESS=TASKLIST /FI "WINDOWTITLE eq %_expression%" /NH
|
set FIND_PROCESS=TASKLIST /FI "WINDOWTITLE eq %_expression%" /NH
|
||||||
FOR /F "usebackq tokens=2 delims= " %%A IN (`cmd /c "%FIND_PROCESS% 2>NUL"`) DO (
|
FOR /F "usebackq tokens=2 delims= " %%A IN (`cmd /c "%FIND_PROCESS% 2>NUL"`) DO (
|
||||||
SET FOUND_PID=%%A
|
SET FOUND_PID=%%A
|
||||||
)
|
)
|
||||||
if defined FOUND_PID (
|
if defined FOUND_PID (
|
||||||
exit /b 0
|
exit /b 0
|
||||||
) else (
|
) else (
|
||||||
set EXCEPTION=%_expression% not found
|
set EXCEPTION=%_expression% not found
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
:forget
|
:forget
|
||||||
SETLOCAL
|
SETLOCAL
|
||||||
set FOUND_PID=
|
set FOUND_PID=
|
||||||
set NEXT_MINUTE=
|
set NEXT_MINUTE=
|
||||||
set INSTANCE_NAME=%1
|
set INSTANCE_NAME=%1
|
||||||
shift
|
shift
|
||||||
set SCRIPT=%1
|
set SCRIPT=%1
|
||||||
shift
|
shift
|
||||||
set LOG_DIR=%1
|
set LOG_DIR=%1
|
||||||
shift
|
shift
|
||||||
CALL :findProcess %INSTANCE_NAME%
|
CALL :findProcess %INSTANCE_NAME%
|
||||||
if defined FOUND_PID (
|
if defined FOUND_PID (
|
||||||
echo %INSTANCE_NAME% already running pid [%FOUND_PID%]
|
echo %INSTANCE_NAME% already running pid [%FOUND_PID%]
|
||||||
) else (
|
) else (
|
||||||
CALL :nextMinute
|
CALL :nextMinute
|
||||||
set _DATE=%DATE:~4%
|
set _DATE=%DATE:~4%
|
||||||
set CMD=schtasks /create /sd %_DATE% /tn %INSTANCE_NAME% /ru System /tr "cmd /c title %INSTANCE_NAME%&%SCRIPT% >%LOG_DIR%\stdout.log 2>%LOG_DIR%\stderr.log" /sc:once /st %NEXT_MINUTE%
|
set CMD=schtasks /create /sd %_DATE% /tn %INSTANCE_NAME% /ru System /tr "cmd /c title %INSTANCE_NAME%&%SCRIPT% >%LOG_DIR%\stdout.log 2>%LOG_DIR%\stderr.log" /sc:once /st %NEXT_MINUTE%
|
||||||
echo %INSTANCE_NAME% will start at %NEXT_MINUTE%
|
echo %INSTANCE_NAME% will start at %NEXT_MINUTE%
|
||||||
set SECONDS=%TIME:~6,2%
|
set SECONDS=%TIME:~6,2%
|
||||||
set /a SECOND=60-SECONDS
|
set /a SECOND=60-SECONDS
|
||||||
%CMD% >NUL
|
%CMD% >NUL
|
||||||
ping -n %SECONDS% 127.0.0.1 > NUL 2>&1
|
ping -n %SECONDS% 127.0.0.1 > NUL 2>&1
|
||||||
CALL :findProcess %INSTANCE_NAME%
|
CALL :findProcess %INSTANCE_NAME%
|
||||||
if not defined FOUND_PID (
|
if not defined FOUND_PID (
|
||||||
set EXCEPTION=%INSTANCE_NAME% did not start
|
set EXCEPTION=%INSTANCE_NAME% did not start
|
||||||
abort
|
abort
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
exit /b 0
|
exit /b 0
|
||||||
:FUNCTION_END
|
:FUNCTION_END
|
||||||
set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem
|
set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem
|
||||||
if not "%1" == "init" if not "%1" == "status" if not "%1" == "stop" if not "%1" == "start" if not "%1" == "tail" if not "%1" == "tailerr" if not "%1" == "run" (
|
if not "%1" == "init" if not "%1" == "status" if not "%1" == "stop" if not "%1" == "start" if not "%1" == "tail" if not "%1" == "tailerr" if not "%1" == "run" (
|
||||||
set EXCEPTION=bad argument: %1 not in init status stop start tail tailerr run
|
set EXCEPTION=bad argument: %1 not in init status stop start tail tailerr run
|
||||||
goto abort
|
goto abort
|
||||||
)
|
)
|
||||||
goto CASE_%1
|
goto CASE_%1
|
||||||
:CASE_init
|
:CASE_init
|
||||||
call :default
|
call :default
|
||||||
if errorlevel 1 goto abort
|
if errorlevel 1 goto abort
|
||||||
call :mkebsboot
|
call :mkebsboot
|
||||||
if errorlevel 1 goto abort
|
if errorlevel 1 goto abort
|
||||||
md %INSTANCE_HOME%
|
md %INSTANCE_HOME%
|
||||||
del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
|
del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
|
||||||
echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo title mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo title mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo set INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo set INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo set TMP_DIR=%TMP_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo set TMP_DIR=%TMP_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo set INSTANCE_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo set INSTANCE_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo set INSTANCE_HOME=%INSTANCE_HOME%>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo set INSTANCE_HOME=%INSTANCE_HOME%>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
md %INSTANCE_HOME%
|
md %INSTANCE_HOME%
|
||||||
del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
|
del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
|
||||||
echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo title mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo title mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo set INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo set INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo set TMP_DIR=%TMP_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo set TMP_DIR=%TMP_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo set INSTANCE_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo set INSTANCE_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo set INSTANCE_HOME=%INSTANCE_HOME%>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo set INSTANCE_HOME=%INSTANCE_HOME%>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
|
echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
echo exit /b 0 >>%INSTANCE_HOME%\mkebsboot.cmd
|
echo exit /b 0 >>%INSTANCE_HOME%\mkebsboot.cmd
|
||||||
GOTO END_SWITCH
|
GOTO END_SWITCH
|
||||||
:CASE_status
|
:CASE_status
|
||||||
call :default
|
call :default
|
||||||
if errorlevel 1 goto abort
|
if errorlevel 1 goto abort
|
||||||
call :findPid %INSTANCE_NAME%
|
call :findPid %INSTANCE_NAME%
|
||||||
if errorlevel 1 goto abort
|
if errorlevel 1 goto abort
|
||||||
echo [%FOUND_PID%]
|
echo [%FOUND_PID%]
|
||||||
GOTO END_SWITCH
|
GOTO END_SWITCH
|
||||||
:CASE_stop
|
:CASE_stop
|
||||||
call :default
|
call :default
|
||||||
if errorlevel 1 goto abort
|
if errorlevel 1 goto abort
|
||||||
call :findPid %INSTANCE_NAME%
|
call :findPid %INSTANCE_NAME%
|
||||||
if errorlevel 1 goto abort
|
if errorlevel 1 goto abort
|
||||||
if defined FOUND_PID (
|
if defined FOUND_PID (
|
||||||
TASKKILL /F /T /PID %FOUND_PID% >NUL
|
TASKKILL /F /T /PID %FOUND_PID% >NUL
|
||||||
)
|
)
|
||||||
GOTO END_SWITCH
|
GOTO END_SWITCH
|
||||||
:CASE_start
|
:CASE_start
|
||||||
call :default
|
call :default
|
||||||
if errorlevel 1 goto abort
|
if errorlevel 1 goto abort
|
||||||
call :forget %INSTANCE_NAME% %INSTANCE_HOME%\%INSTANCE_NAME%.cmd %LOG_DIR%
|
call :forget %INSTANCE_NAME% %INSTANCE_HOME%\%INSTANCE_NAME%.cmd %LOG_DIR%
|
||||||
if errorlevel 1 goto abort
|
if errorlevel 1 goto abort
|
||||||
GOTO END_SWITCH
|
GOTO END_SWITCH
|
||||||
:CASE_tail
|
:CASE_tail
|
||||||
call :default
|
call :default
|
||||||
if errorlevel 1 goto abort
|
if errorlevel 1 goto abort
|
||||||
tail %LOG_DIR%\stdout.log
|
tail %LOG_DIR%\stdout.log
|
||||||
GOTO END_SWITCH
|
GOTO END_SWITCH
|
||||||
:CASE_tailerr
|
:CASE_tailerr
|
||||||
call :default
|
call :default
|
||||||
if errorlevel 1 goto abort
|
if errorlevel 1 goto abort
|
||||||
tail %LOG_DIR%\stderr.log
|
tail %LOG_DIR%\stderr.log
|
||||||
GOTO END_SWITCH
|
GOTO END_SWITCH
|
||||||
:CASE_run
|
:CASE_run
|
||||||
call :default
|
call :default
|
||||||
if errorlevel 1 goto abort
|
if errorlevel 1 goto abort
|
||||||
%INSTANCE_HOME%\%INSTANCE_NAME%.cmd
|
%INSTANCE_HOME%\%INSTANCE_NAME%.cmd
|
||||||
GOTO END_SWITCH
|
GOTO END_SWITCH
|
||||||
:END_SWITCH
|
:END_SWITCH
|
||||||
exit /b 0
|
exit /b 0
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
md %TEMP%\%USERNAME%\scripttest
|
md %TEMP%\%USERNAME%\scripttest
|
||||||
del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
|
del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
|
||||||
echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
||||||
echo title yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
echo title yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
||||||
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
||||||
echo set INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
echo set INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
||||||
echo set JAVA_HOME=%JAVA_HOME%>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
echo set JAVA_HOME=%JAVA_HOME%>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
||||||
echo cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
echo cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
||||||
md %TEMP%\%USERNAME%\scripttest
|
md %TEMP%\%USERNAME%\scripttest
|
||||||
del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
|
del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
|
||||||
echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
||||||
echo title yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
echo title yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
||||||
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
||||||
echo set INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
echo set INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
||||||
echo set JAVA_HOME=%JAVA_HOME%>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
echo set JAVA_HOME=%JAVA_HOME%>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
||||||
echo cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
echo cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
||||||
echo exit /b 0 >>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
echo exit /b 0 >>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
@echo off
|
@echo off
|
||||||
set PATH=
|
set PATH=
|
||||||
set JAVA_HOME=
|
set JAVA_HOME=
|
||||||
set PATH=
|
set PATH=
|
||||||
set RUNTIME=
|
set RUNTIME=
|
||||||
GOTO FUNCTION_END
|
GOTO FUNCTION_END
|
||||||
:abort
|
:abort
|
||||||
echo aborting: %EXCEPTION%
|
echo aborting: %EXCEPTION%
|
||||||
exit /b 1
|
exit /b 1
|
||||||
:default
|
:default
|
||||||
set RUNTIME=Moo
|
set RUNTIME=Moo
|
||||||
exit /b 0
|
exit /b 0
|
||||||
:FUNCTION_END
|
:FUNCTION_END
|
||||||
set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem
|
set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem
|
||||||
if not "%1" == "start" if not "%1" == "stop" if not "%1" == "status" (
|
if not "%1" == "start" if not "%1" == "stop" if not "%1" == "status" (
|
||||||
set EXCEPTION=bad argument: %1 not in start stop status
|
set EXCEPTION=bad argument: %1 not in start stop status
|
||||||
goto abort
|
goto abort
|
||||||
)
|
)
|
||||||
goto CASE_%1
|
goto CASE_%1
|
||||||
:CASE_start
|
:CASE_start
|
||||||
call :default
|
call :default
|
||||||
if errorlevel 1 goto abort
|
if errorlevel 1 goto abort
|
||||||
echo start %RUNTIME%
|
echo start %RUNTIME%
|
||||||
GOTO END_SWITCH
|
GOTO END_SWITCH
|
||||||
:CASE_stop
|
:CASE_stop
|
||||||
call :default
|
call :default
|
||||||
if errorlevel 1 goto abort
|
if errorlevel 1 goto abort
|
||||||
echo stop %RUNTIME%
|
echo stop %RUNTIME%
|
||||||
GOTO END_SWITCH
|
GOTO END_SWITCH
|
||||||
:CASE_status
|
:CASE_status
|
||||||
echo hello world>>%TEMP%\%USERNAME%\scripttest\temp.txt
|
echo hello world>>%TEMP%\%USERNAME%\scripttest\temp.txt
|
||||||
echo the following should be []: [%RUNTIME%]
|
echo the following should be []: [%RUNTIME%]
|
||||||
GOTO END_SWITCH
|
GOTO END_SWITCH
|
||||||
:END_SWITCH
|
:END_SWITCH
|
||||||
exit /b 0
|
exit /b 0
|
||||||
|
|
|
@ -65,9 +65,10 @@ public class ParseSlicehostErrorFromHttpResponse implements HttpErrorHandler {
|
||||||
Exception exception = new HttpResponseException(command, response);
|
Exception exception = new HttpResponseException(command, response);
|
||||||
try {
|
try {
|
||||||
String content = response.getStatusCode() != 401 ? parseErrorFromContentOrNull(command, response) : null;
|
String content = response.getStatusCode() != 401 ? parseErrorFromContentOrNull(command, response) : null;
|
||||||
|
exception = content != null ? new HttpResponseException(command, response, content) : exception;
|
||||||
switch (response.getStatusCode()) {
|
switch (response.getStatusCode()) {
|
||||||
case 401:
|
case 401:
|
||||||
exception = new AuthorizationException(command.getRequest(), content);
|
exception = new AuthorizationException(exception.getMessage(), exception);
|
||||||
break;
|
break;
|
||||||
case 403:
|
case 403:
|
||||||
case 404:
|
case 404:
|
||||||
|
|
|
@ -79,6 +79,7 @@ public class ParseVCloudErrorFromHttpResponse implements HttpErrorHandler {
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
message = Utils.toStringAndClose(response.getPayload().getInput());
|
message = Utils.toStringAndClose(response.getPayload().getInput());
|
||||||
|
exception = message != null ? new HttpResponseException(command, response, message) : exception;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +97,7 @@ public class ParseVCloudErrorFromHttpResponse implements HttpErrorHandler {
|
||||||
break;
|
break;
|
||||||
case 401:
|
case 401:
|
||||||
case 403:
|
case 403:
|
||||||
exception = new AuthorizationException(command.getRequest(), message);
|
exception = new AuthorizationException(exception.getMessage(), exception);
|
||||||
break;
|
break;
|
||||||
case 404:
|
case 404:
|
||||||
if (!command.getRequest().getMethod().equals("DELETE")) {
|
if (!command.getRequest().getMethod().equals("DELETE")) {
|
||||||
|
|
|
@ -54,6 +54,8 @@ public class ParseTerremarkVCloudErrorFromHttpResponse implements HttpErrorHandl
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String content = parseErrorFromContentOrNull(command, response);
|
String content = parseErrorFromContentOrNull(command, response);
|
||||||
|
if (content != null)
|
||||||
|
exception = new HttpResponseException(command, response, content);
|
||||||
if (response.getMessage() != null
|
if (response.getMessage() != null
|
||||||
&& ((response.getMessage().indexOf("because there is a pending task running") != -1)
|
&& ((response.getMessage().indexOf("because there is a pending task running") != -1)
|
||||||
|| (response.getMessage().indexOf("because it is already powered off") != -1)
|
|| (response.getMessage().indexOf("because it is already powered off") != -1)
|
||||||
|
@ -65,7 +67,7 @@ public class ParseTerremarkVCloudErrorFromHttpResponse implements HttpErrorHandl
|
||||||
exception = new IllegalArgumentException(response.getMessage(), exception);
|
exception = new IllegalArgumentException(response.getMessage(), exception);
|
||||||
break;
|
break;
|
||||||
case 401:
|
case 401:
|
||||||
exception = new AuthorizationException(command.getRequest(), content);
|
exception = new AuthorizationException(exception.getMessage(), exception);
|
||||||
break;
|
break;
|
||||||
case 403: // TODO temporary as terremark mistakenly uses this for vApp
|
case 403: // TODO temporary as terremark mistakenly uses this for vApp
|
||||||
// not found.
|
// not found.
|
||||||
|
|
Loading…
Reference in New Issue