You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2021/01/14 15:01:55 UTC
[karaf] branch master updated: maven-release-plugin: fixed
installing boot feature with missing config file.
This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/master by this push:
new 5f826e6 maven-release-plugin: fixed installing boot feature with missing config file.
new 0629a5b Merge pull request #1288 from jojansen/KARAF-6992
5f826e6 is described below
commit 5f826e6b4cc16e0d117db945c831888aca6d1f81
Author: jjansen <jo...@inform-software.com>
AuthorDate: Tue Jan 12 08:47:34 2021 +0100
maven-release-plugin: fixed installing boot feature with missing config file.
---
.../org/apache/karaf/profile/assembly/ConfigInstaller.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/profile/src/main/java/org/apache/karaf/profile/assembly/ConfigInstaller.java b/profile/src/main/java/org/apache/karaf/profile/assembly/ConfigInstaller.java
index df928f5..4f78059 100644
--- a/profile/src/main/java/org/apache/karaf/profile/assembly/ConfigInstaller.java
+++ b/profile/src/main/java/org/apache/karaf/profile/assembly/ConfigInstaller.java
@@ -65,7 +65,8 @@ public class ConfigInstaller {
for (Config config : content.getConfig()) {
if (pidMatching(config.getName())) {
Path configFile = etcDirectory.resolve(config.getName() + ".cfg");
- if (!config.isAppend() && Files.exists(configFile)) {
+ boolean configFileExist = Files.exists(configFile);
+ if (!config.isAppend() && configFileExist) {
LOGGER.info(" not changing existing config file: {}", homeDirectory.relativize(configFile));
continue;
}
@@ -84,8 +85,13 @@ public class ConfigInstaller {
});
} else {
if (config.isAppend()) {
- LOGGER.info(" appending to config file: {}", homeDirectory.relativize(configFile));
- Files.write(configFile, config.getValue().getBytes(), StandardOpenOption.APPEND);
+ if (configFileExist) {
+ LOGGER.info(" appending to config file: {}", homeDirectory.relativize(configFile));
+ Files.write(configFile, config.getValue().getBytes(), StandardOpenOption.APPEND);
+ }
+ else
+ LOGGER.warn(" Could not append, because config file does not exist: {}", homeDirectory.relativize(configFile));
+
} else {
LOGGER.info(" adding config file: {}", homeDirectory.relativize(configFile));
Files.write(configFile, config.getValue().getBytes());