Skip to content

Commit 08c6f0e

Browse files
committed
allow actual execution, fix script
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent 238bc19 commit 08c6f0e

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

plugins/hypervisors/external/src/main/java/org/apache/cloudstack/hypervisor/external/provisioner/simpleprovisioner/SimpleExternalProvisioner.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -544,12 +544,12 @@ public Pair<Boolean, String> executeExternalCommand(String file, String action,
544544
builder.redirectErrorStream(true);
545545

546546
if (IS_DEBUG) {
547-
logger.info("Executable: {}",executablePath);
548-
logger.info("Action: {} with wait: {}", action, wait);
549-
logger.info("Data file: {}", dataFile);
550-
return new Pair<>(true, "Operation successful!");
547+
logger.debug("Executable: {}",executablePath);
548+
logger.debug("Action: {} with wait: {}", action, wait);
549+
logger.debug("Data file: {}", dataFile);
550+
// return new Pair<>(true, "Operation successful!");
551551
}
552-
logger.debug("Executing command: {}", command);
552+
logger.debug("Executing command: {}", action);
553553
Process process = builder.start();
554554
boolean finished = process.waitFor(wait, TimeUnit.SECONDS);
555555
if (!finished) {

scripts/vm/hypervisor/external/simpleExternalProvisioner/provisioner.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,22 @@ status() {
8080
}
8181

8282
action=$1
83-
parameters=$2
84-
wait_time=$3
83+
parameters_file="$2"
84+
wait_time="$3"
8585

86-
if [[ -z $action || -z $parameters ]]; then
86+
if [[ -z "$action" || -z "$parameters_file" ]]; then
8787
echo '{"error":"Missing required arguments"}'
8888
exit 1
8989
fi
9090

91+
if [[ ! -r "$parameters_file" ]]; then
92+
echo '{"error":"File not found or unreadable"}'
93+
exit 1
94+
fi
95+
96+
# Read file content as parameters (assumes space-separated arguments)
97+
parameters=$(<"$parameters_file")
98+
9199
case $action in
92100
prepare)
93101
prepare "$parameters"

0 commit comments

Comments
 (0)