You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Rastislav Papp (Jira)" <ji...@apache.org> on 2021/10/07 14:14:00 UTC
[jira] [Comment Edited] (KARAF-7187) cfg file layout is destoyed
when reinstalling existing feature
[ https://issues.apache.org/jira/browse/KARAF-7187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17425578#comment-17425578 ]
Rastislav Papp edited comment on KARAF-7187 at 10/7/21, 2:13 PM:
-----------------------------------------------------------------
[~jbonofre], no, keys are kept, but *both* values and formatting are changed. Values get their placeholders replaced, for example:
{code}
key1=file:C:/rootDir
key2=${key1}/subDir
{code}
becomes:
{code}
key1=file:C:/rootDir
key2=file:C:/rootDir/subDir
{code}
This in itself is not that bad, because it at least works (as long as we do not change property value of key1). But in some places we have a camel simple expression in a property, which uses the same property placeholder format, e.g.:
{code}
key=${body}
{code}
and this changes to:
{code}
key=
{code}
which is no longer a working camel expression :)
was (Author: rastislav.papp):
[~jbonofre], no, keys are kept, but *both* values and formatting are changed. Values get their placeholders replaced, for example:
{code}
key1=file:C:/rootDir
key2=${key1}/subDir
{code}
becomes:
{code}
key1=file:C:/rootDir
key2=file:C:/rootDir/subDir
{code}
This in itself is not that bad, because it at least works (as long as we do not change property value of key1). But in some places we have a camel simple expression in a property, which uses the same property placeholder format, e.g.:
{code}
key=${body}
{code}
and this resolves to:
{code}
key=
{code}
which is no longer a working camel expression :)
> cfg file layout is destoyed when reinstalling existing feature
> --------------------------------------------------------------
>
> Key: KARAF-7187
> URL: https://issues.apache.org/jira/browse/KARAF-7187
> Project: Karaf
> Issue Type: Bug
> Components: karaf
> Affects Versions: 4.3.2
> Reporter: Rastislav Papp
> Assignee: Jean-Baptiste Onofré
> Priority: Major
>
> Let's say we have a cfg file, which is part of a feature (via {{<config external="true" override="true">}}).
> When we install the feature installed for the first time, this file is created under /etc directory. When I uninstall the feature, the file is kept, and when I install it again, the file gets broken - it's layout is destroyed and all property placeholders inside are replaced with actual values - which could be a problem (i.e. when updating the value of the placeholder).
> To illustrate, let's say we have this cfg file:
> {code:java}
> property1=value1
> property2=\
> xxx${property1}yyy\
> continuing the value on another line
> {code}
> After uninstalling and reinstalling a feature which overwrites this file, the result is:
> {code:java}
> property1=value1
> property2=xxxvalue1yyycontinuing the value on another line
> {code}
> which is not at all good:
> * when updating value of property1, we expect that property2 will change accordingly (but it no longer does)
> * multiline formatting is lost
> The culprint is {{org.apache.karaf.features.internal.service.FeatureConfigInstaller#updateExistingConfig}}, line:
> {code:java}
> properties.put(key, comments, value);
> {code}
> which eventually calls {{org.apache.felix.utils.properties.Properties#put(java.lang.String, java.util.List<java.lang.String>, java.lang.String)}}, causing the original {{Layout}} to be lost:
> {code:java}
> this.layout.put(key, new Layout(commentLines, null));
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)