Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit fb6a518

Browse files
committed
#340 Tweaked logging for installing plugins
1 parent 5624083 commit fb6a518

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/main/java/com/marklogic/appdeployer/command/plugins/InstallPluginsCommand.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,13 @@ protected File findPluginZipInDirectory(File dir) {
131131

132132
protected void installPlugin(String uri, AppConfig appConfig, DatabaseClient client) {
133133
final String scope = appConfig.getPluginConfig().getScope();
134+
final String script = appConfig.getPluginConfig().getInstallScript();
134135
ServerEvaluationCall eval = client
135136
.newServerEval()
136-
.xquery(appConfig.getPluginConfig().getInstallScript())
137+
.xquery(script)
137138
.addVariable("uri", uri)
138139
.addVariable("scope", scope);
139-
logger.info(format("Installing plugin with scope '%s' from URI: %s", scope, uri));
140+
logger.info(format("Installing plugin with scope '%s' from URI '%s' via script: %s", scope, uri, script));
140141
String result = eval.evalAs(String.class);
141142
logger.info(format("Installed plugin with scope '%s', result: %s", scope, result));
142143
}
@@ -179,13 +180,18 @@ protected String getPluginName(File dir, AppConfig appConfig) {
179180

180181
protected void uninstallPlugin(String pluginName, AppConfig appConfig, DatabaseClient client) {
181182
final String scope = appConfig.getPluginConfig().getScope() + "/" + pluginName;
183+
final String script = appConfig.getPluginConfig().getUninstallScript();
182184
ServerEvaluationCall eval = client
183185
.newServerEval()
184-
.xquery(appConfig.getPluginConfig().getUninstallScript())
186+
.xquery(script)
185187
.addVariable("scope", scope);
186-
logger.info(format("Uninstalling plugin with scope '%s'", scope));
188+
logger.info(format("Uninstalling plugin with scope '%s' via script: %s", scope, script));
187189
String result = eval.evalAs(String.class);
188-
logger.info(format("Uninstalled plugin with scope '%s', result: %s", scope, result));
190+
if (result != null && result.trim().length() > 0) {
191+
logger.info(format("Uninstalled plugin with scope '%s', result: %s", scope, result));
192+
} else {
193+
logger.info(format("Uninstalled plugin with scope '%s'", scope));
194+
}
189195
}
190196

191197
/**

0 commit comments

Comments
 (0)