Skip to content

Commit 5dcb7aa

Browse files
committed
fix
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent bf4cc9e commit 5dcb7aa

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private String getExtensionCheckedScriptPath(String extensionName) {
138138
logger.error("Provisioner script {} for extension: {} does not exist", path, extensionName);
139139
return null;
140140
}
141-
if (!file.exists()) {
141+
if (!file.isFile()) {
142142
logger.error("Provisioner script {} for extension: {} is not a file", path, extensionName);
143143
return null;
144144
}
@@ -154,6 +154,16 @@ private String getExtensionCheckedScriptPath(String extensionName) {
154154
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
155155
super.configure(name, params);
156156
extensionsDirectory = ExtensionsDirectory.value();
157+
if (StringUtils.isBlank(extensionsDirectory)) {
158+
throw new ConfigurationException("Extension directory path is blank");
159+
}
160+
161+
File dir = new File(extensionsDirectory);
162+
if (!dir.exists() || !dir.isDirectory() || !dir.canWrite()) {
163+
String msg = String.format("Extension directory [%s] is not properly set up", extensionsDirectory);
164+
logger.error("{}. It must exist, be a directory, and be writeable", msg);
165+
throw new ConfigurationException(msg);
166+
}
157167
return true;
158168
}
159169

0 commit comments

Comments
 (0)