You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Markus Rathgeb (JIRA)" <ji...@apache.org> on 2017/09/04 15:53:01 UTC

[jira] [Created] (KARAF-5335) Karaf assembly prpperty edit not working reliable

Markus Rathgeb created KARAF-5335:
-------------------------------------

             Summary: Karaf assembly prpperty edit not working reliable
                 Key: KARAF-5335
                 URL: https://issues.apache.org/jira/browse/KARAF-5335
             Project: Karaf
          Issue Type: Bug
          Components: karaf-tooling
    Affects Versions: 4.1.2
            Reporter: Markus Rathgeb


In a custom distribution we could use the file "src/main/karaf/assembly-property-edits.xml" to edit porperty files on assembly stage.

This does work for some files but don't for other ones - at least if we look at the final result.
Perhaps all files are edited and some are overwritten again, I don't know -- but it seems so.

So, perhaps it is not only about "karaf-tooling" but also other components that overwrite existing files.

I created a simple custom distribution project to reproduce the error:
https://github.com/maggu2810/karaf-demo/tree/master/assembly-property-edits-unclear

There is a "src/main/karaf/assembly-property-edits.xml" that want to ensure that there are one property available in two files.

* test=test in system.properties
* sshHost=127.0.0.1 in org.apache.karaf.shell.cfg

The file looks like
{noformat}
<?xml version="1.0"?>
<property-edits xmlns="http://karaf.apache.org/tools/property-edits/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://karaf.apache.org/tools/property-edits/1.0.0 http://karaf.apache.org/xsd/property-edits-1.0.0.xsd">
  <edits>

    <edit>
      <file>system.properties</file>
      <operation>put</operation>
      <key>test</key>
      <value>test</value>
    </edit>

    <edit>
      <file>org.apache.karaf.shell.cfg</file>
      <operation>put</operation>
      <key>sshHost</key>
      <value>127.0.0.1</value>
    </edit>

  </edits>
</property-edits>
{noformat}

The first one works as expected:
{noformat}
$ grep test= ./target/assembly/etc/system.properties 
test=test
{noformat}

The second one doesn't
{noformat}
grep sshHost ./target/assembly/etc/org.apache.karaf.shell.cfg
sshHost=0.0.0.0
{noformat}

Changes on e.g. org.ops4j.pax.web.cfg are also overwritten again.

I assume (but don't know) the feature installation on assembly stage overwrites existing configuration files.
Is this the expected behavior?

Would it be possible to move the property edit after that stage so files that are added by the feature installation are edited?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)