Karaf assembly plugin property edits erasing properties

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Karaf assembly plugin property edits erasing properties

Alex Soto
Hello,

Using Karaf 4.2.0, I want to update a property in my custom distribution. So I add file src/main/karaf/assembly-property-edits.xml with: 

<edit>
    <file>org.ops4j.pax.web.cfg</file>
    <operation>put</operation>
    <key>org.osgi.service.http.port</key>
    <value>8182</value>
</edit>

The result is:

#Modified by org.apache.karaf.tools.utils.KarafPropertiesFile
#Thu Jun 07 15:39:28 EDT 2018
org.osgi.service.http.port=8182


The issue is that it erased all other properties.  Normally, this file has the following:

org.osgi.service.http.port=8181
javax.servlet.context.tempdir=${karaf.data}/pax-web-jsp
org.ops4j.pax.web.config.file=${karaf.etc}/jetty.xml


Is this the expected behavior?   How can I preserve the rest of the properties and modify just one?

Best regards,
Alex soto


SvS
Reply | Threaded
Open this post in threaded view
|

Re: Karaf assembly plugin property edits erasing properties

SvS
Hi Alex,

I have similar problems. In my opinion, it is not the expected behavior.
Older versions work as you would like. I am using the old version of the
karaf-maven plugin (4.0.10).

See  this
<http://karaf.922171.n3.nabble.com/Problems-with-using-configurations-in-custom-distribution-tp4052548.html>  
post.

I will see if I can do anything with it.



-----
Regards,
SvS
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Regards,
SvS
Reply | Threaded
Open this post in threaded view
|

Re: Karaf assembly plugin property edits erasing properties

jbonofre
In reply to this post by Alex Soto
Did you set append on the edit ?

Regards
JB

On 07/06/2018 21:47, Alex Soto wrote:

> Hello,
>
> Using Karaf 4.2.0, I want to update a property in my custom
> distribution. So I add file /src/main/karaf/assembly-property-edits.xml/
> with: 
>
>     <edit>
>         <file>org.ops4j.pax.web.cfg</file>
>         <operation>put</operation>
>         <key>org.osgi.service.http.port</key>
>         <value>8182</value>
>     </edit>
>
>
> The result is:
>
>     #Modified by org.apache.karaf.tools.utils.KarafPropertiesFile
>     #Thu Jun 07 15:39:28 EDT 2018
>     org.osgi.service.http.port=8182
>
>
>
> The issue is that it erased all other properties.  Normally, this file
> has the following:
>
>     org.osgi.service.http.port=8181
>     javax.servlet.context.tempdir=${karaf.data}/pax-web-jsp
>     org.ops4j.pax.web.config.file=${karaf.etc}/jetty.xml
>
>
>
> Is this the expected behavior?   How can I preserve the rest of the
> properties and modify just one?
>
> Best regards,
> Alex soto
>
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Karaf assembly plugin property edits erasing properties

Alex Soto
Append?  No, I've never seen this documented anywhere, can you point me to a documentation resource where this is mentioned/illustrated?

Best regards,
Alex soto




On Jun 8, 2018, at 8:52 AM, Jean-Baptiste Onofré <[hidden email]> wrote:

Did you set append on the edit ?

Regards
JB

On 07/06/2018 21:47, Alex Soto wrote:
Hello,

Using Karaf 4.2.0, I want to update a property in my custom
distribution. So I add file /src/main/karaf/assembly-property-edits.xml/
with: 

   <edit>
       <file>org.ops4j.pax.web.cfg</file>
       <operation>put</operation>
       <key>org.osgi.service.http.port</key>
       <value>8182</value>
   </edit>


The result is:

   #Modified by org.apache.karaf.tools.utils.KarafPropertiesFile
   #Thu Jun 07 15:39:28 EDT 2018
   org.osgi.service.http.port=8182



The issue is that it erased all other properties.  Normally, this file
has the following:

   org.osgi.service.http.port=8181
   javax.servlet.context.tempdir=${karaf.data}/pax-web-jsp
   org.ops4j.pax.web.config.file=${karaf.etc}/jetty.xml



Is this the expected behavior?   How can I preserve the rest of the
properties and modify just one?

Best regards,
Alex soto



--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply | Threaded
Open this post in threaded view
|

Re: Karaf assembly plugin property edits erasing properties

fpapon

Hi Alex,

Here an example :

<property-edits xmlns="http://karaf.apache.org/tools/property-edits/1.0.0">
         <edits>
          <edit>
            <file>config.properties</file>
            <operation>put</operation>
            <key>karaf.framework</key>
            <value>equinox</value>
          </edit>
          <edit>
            <file>config.properties</file>
            <operation>extend</operation>
            <key>org.osgi.framework.system.capabilities</key>
            <value>my-magic-capability</value>
          </edit>
          <edit>
            <file>config.properties</file>
            <operation prepend='true'>extend</operation>
            <key>some-other-list</key>
            <value>my-value-goes-first</value>
            </edit>
         </edits>
      </property-edits>


François Papon
[hidden email]
Open3m - https://www.open3m.io
Le 08/06/2018 à 19:29, Alex Soto a écrit :
Append?  No, I've never seen this documented anywhere, can you point me to a documentation resource where this is mentioned/illustrated?

Best regards,
Alex soto




On Jun 8, 2018, at 8:52 AM, Jean-Baptiste Onofré <[hidden email]> wrote:

Did you set append on the edit ?

Regards
JB

On 07/06/2018 21:47, Alex Soto wrote:
Hello,

Using Karaf 4.2.0, I want to update a property in my custom
distribution. So I add file /src/main/karaf/assembly-property-edits.xml/
with: 

   <edit>
       <file>org.ops4j.pax.web.cfg</file>
       <operation>put</operation>
       <key>org.osgi.service.http.port</key>
       <value>8182</value>
   </edit>


The result is:

   #Modified by org.apache.karaf.tools.utils.KarafPropertiesFile
   #Thu Jun 07 15:39:28 EDT 2018
   org.osgi.service.http.port=8182



The issue is that it erased all other properties.  Normally, this file
has the following:

   org.osgi.service.http.port=8181
   javax.servlet.context.tempdir=${karaf.data}/pax-web-jsp
   org.ops4j.pax.web.config.file=${karaf.etc}/jetty.xml



Is this the expected behavior?   How can I preserve the rest of the
properties and modify just one?

Best regards,
Alex soto



--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com


Francois Papon
Openrun : https://www.openrun.re
Reply | Threaded
Open this post in threaded view
|

Re: Karaf assembly plugin property edits erasing properties

Alex Soto
Hi François, JB mentioned “append” but I do not see any “append” in your example.
As I indicated in my original post, I am using <opertation>put</operation> but all other properties in the file are being removed.

Best regards,
Alex soto




On Jun 8, 2018, at 11:43 AM, Francois Papon <[hidden email]> wrote:

Hi Alex,

Here an example :

<property-edits xmlns="http://karaf.apache.org/tools/property-edits/1.0.0">
         <edits>
          <edit>
            <file>config.properties</file>
            <operation>put</operation>
            <key>karaf.framework</key>
            <value>equinox</value>
          </edit>
          <edit>
            <file>config.properties</file>
            <operation>extend</operation>
            <key>org.osgi.framework.system.capabilities</key>
            <value>my-magic-capability</value>
          </edit>
          <edit>
            <file>config.properties</file>
            <operation prepend='true'>extend</operation>
            <key>some-other-list</key>
            <value>my-value-goes-first</value>
            </edit>
         </edits>
      </property-edits>


François Papon
[hidden email]
Open3m - https://www.open3m.io
Le 08/06/2018 à 19:29, Alex Soto a écrit :
Append?  No, I've never seen this documented anywhere, can you point me to a documentation resource where this is mentioned/illustrated?

Best regards,
Alex soto




On Jun 8, 2018, at 8:52 AM, Jean-Baptiste Onofré <[hidden email]> wrote:

Did you set append on the edit ?

Regards
JB

On 07/06/2018 21:47, Alex Soto wrote:
Hello,

Using Karaf 4.2.0, I want to update a property in my custom
distribution. So I add file /src/main/karaf/assembly-property-edits.xml/
with: 

   <edit>
       <file>org.ops4j.pax.web.cfg</file>
       <operation>put</operation>
       <key>org.osgi.service.http.port</key>
       <value>8182</value>
   </edit>


The result is:

   #Modified by org.apache.karaf.tools.utils.KarafPropertiesFile
   #Thu Jun 07 15:39:28 EDT 2018
   org.osgi.service.http.port=8182



The issue is that it erased all other properties.  Normally, this file
has the following:

   org.osgi.service.http.port=8181
   javax.servlet.context.tempdir=${karaf.data}/pax-web-jsp
   org.ops4j.pax.web.config.file=${karaf.etc}/jetty.xml



Is this the expected behavior?   How can I preserve the rest of the
properties and modify just one?

Best regards,
Alex soto



--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com



Reply | Threaded
Open this post in threaded view
|

Re: Karaf assembly plugin property edits erasing properties

fpapon

Mmm weird, because I used "extend" and it appended in the end of the property file.

Can you try ?

François Papon
[hidden email]
Open3m - https://www.open3m.io
Le 08/06/2018 à 19:54, Alex Soto a écrit :
Hi François, JB mentioned “append” but I do not see any “append” in your example.
As I indicated in my original post, I am using <opertation>put</operation> but all other properties in the file are being removed.

Best regards,
Alex soto




On Jun 8, 2018, at 11:43 AM, Francois Papon <[hidden email]> wrote:

Hi Alex,

Here an example :

<property-edits xmlns="http://karaf.apache.org/tools/property-edits/1.0.0">
         <edits>
          <edit>
            <file>config.properties</file>
            <operation>put</operation>
            <key>karaf.framework</key>
            <value>equinox</value>
          </edit>
          <edit>
            <file>config.properties</file>
            <operation>extend</operation>
            <key>org.osgi.framework.system.capabilities</key>
            <value>my-magic-capability</value>
          </edit>
          <edit>
            <file>config.properties</file>
            <operation prepend='true'>extend</operation>
            <key>some-other-list</key>
            <value>my-value-goes-first</value>
            </edit>
         </edits>
      </property-edits>


François Papon
[hidden email]
Open3m - https://www.open3m.io
Le 08/06/2018 à 19:29, Alex Soto a écrit :
Append?  No, I've never seen this documented anywhere, can you point me to a documentation resource where this is mentioned/illustrated?

Best regards,
Alex soto




On Jun 8, 2018, at 8:52 AM, Jean-Baptiste Onofré <[hidden email]> wrote:

Did you set append on the edit ?

Regards
JB

On 07/06/2018 21:47, Alex Soto wrote:
Hello,

Using Karaf 4.2.0, I want to update a property in my custom
distribution. So I add file /src/main/karaf/assembly-property-edits.xml/
with: 

   <edit>
       <file>org.ops4j.pax.web.cfg</file>
       <operation>put</operation>
       <key>org.osgi.service.http.port</key>
       <value>8182</value>
   </edit>


The result is:

   #Modified by org.apache.karaf.tools.utils.KarafPropertiesFile
   #Thu Jun 07 15:39:28 EDT 2018
   org.osgi.service.http.port=8182



The issue is that it erased all other properties.  Normally, this file
has the following:

   org.osgi.service.http.port=8181
   javax.servlet.context.tempdir=${karaf.data}/pax-web-jsp
   org.ops4j.pax.web.config.file=${karaf.etc}/jetty.xml



Is this the expected behavior?   How can I preserve the rest of the
properties and modify just one?

Best regards,
Alex soto



--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com




Francois Papon
Openrun : https://www.openrun.re
Reply | Threaded
Open this post in threaded view
|

Re: Karaf assembly plugin property edits erasing properties

Alex Soto
I understand “extend” will append the value to the existing property, not what I am looking for, but I tried, and still didn’t work, i.e., same result.

Best regards,
Alex soto




On Jun 8, 2018, at 12:46 PM, Francois Papon <[hidden email]> wrote:

Mmm weird, because I used "extend" and it appended in the end of the property file.

Can you try ?

François Papon
[hidden email]
Open3m - https://www.open3m.io
Le 08/06/2018 à 19:54, Alex Soto a écrit :
Hi François, JB mentioned “append” but I do not see any “append” in your example.
As I indicated in my original post, I am using <opertation>put</operation> but all other properties in the file are being removed.

Best regards,
Alex soto




On Jun 8, 2018, at 11:43 AM, Francois Papon <[hidden email]> wrote:

Hi Alex,

Here an example :

<property-edits xmlns="http://karaf.apache.org/tools/property-edits/1.0.0">
         <edits>
          <edit>
            <file>config.properties</file>
            <operation>put</operation>
            <key>karaf.framework</key>
            <value>equinox</value>
          </edit>
          <edit>
            <file>config.properties</file>
            <operation>extend</operation>
            <key>org.osgi.framework.system.capabilities</key>
            <value>my-magic-capability</value>
          </edit>
          <edit>
            <file>config.properties</file>
            <operation prepend='true'>extend</operation>
            <key>some-other-list</key>
            <value>my-value-goes-first</value>
            </edit>
         </edits>
      </property-edits>


François Papon
[hidden email]
Open3m - https://www.open3m.io
Le 08/06/2018 à 19:29, Alex Soto a écrit :
Append?  No, I've never seen this documented anywhere, can you point me to a documentation resource where this is mentioned/illustrated?

Best regards,
Alex soto




On Jun 8, 2018, at 8:52 AM, Jean-Baptiste Onofré <[hidden email]> wrote:

Did you set append on the edit ?

Regards
JB

On 07/06/2018 21:47, Alex Soto wrote:
Hello,

Using Karaf 4.2.0, I want to update a property in my custom
distribution. So I add file /src/main/karaf/assembly-property-edits.xml/
with: 

   <edit>
       <file>org.ops4j.pax.web.cfg</file>
       <operation>put</operation>
       <key>org.osgi.service.http.port</key>
       <value>8182</value>
   </edit>


The result is:

   #Modified by org.apache.karaf.tools.utils.KarafPropertiesFile
   #Thu Jun 07 15:39:28 EDT 2018
   org.osgi.service.http.port=8182



The issue is that it erased all other properties.  Normally, this file
has the following:

   org.osgi.service.http.port=8181
   javax.servlet.context.tempdir=${karaf.data}/pax-web-jsp
   org.ops4j.pax.web.config.file=${karaf.etc}/jetty.xml



Is this the expected behavior?   How can I preserve the rest of the
properties and modify just one?

Best regards,
Alex soto



--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com





Reply | Threaded
Open this post in threaded view
|

Re: Karaf assembly plugin property edits erasing properties

fpapon

Ok, sorry for the understanding.

François Papon
[hidden email]
Open3m - https://www.open3m.io
Le 08/06/2018 à 20:52, Alex Soto a écrit :
I understand “extend” will append the value to the existing property, not what I am looking for, but I tried, and still didn’t work, i.e., same result.

Best regards,
Alex soto




On Jun 8, 2018, at 12:46 PM, Francois Papon <[hidden email]> wrote:

Mmm weird, because I used "extend" and it appended in the end of the property file.

Can you try ?

François Papon
[hidden email]
Open3m - https://www.open3m.io
Le 08/06/2018 à 19:54, Alex Soto a écrit :
Hi François, JB mentioned “append” but I do not see any “append” in your example.
As I indicated in my original post, I am using <opertation>put</operation> but all other properties in the file are being removed.

Best regards,
Alex soto




On Jun 8, 2018, at 11:43 AM, Francois Papon <[hidden email]> wrote:

Hi Alex,

Here an example :

<property-edits xmlns="http://karaf.apache.org/tools/property-edits/1.0.0">
         <edits>
          <edit>
            <file>config.properties</file>
            <operation>put</operation>
            <key>karaf.framework</key>
            <value>equinox</value>
          </edit>
          <edit>
            <file>config.properties</file>
            <operation>extend</operation>
            <key>org.osgi.framework.system.capabilities</key>
            <value>my-magic-capability</value>
          </edit>
          <edit>
            <file>config.properties</file>
            <operation prepend='true'>extend</operation>
            <key>some-other-list</key>
            <value>my-value-goes-first</value>
            </edit>
         </edits>
      </property-edits>


François Papon
[hidden email]
Open3m - https://www.open3m.io
Le 08/06/2018 à 19:29, Alex Soto a écrit :
Append?  No, I've never seen this documented anywhere, can you point me to a documentation resource where this is mentioned/illustrated?

Best regards,
Alex soto




On Jun 8, 2018, at 8:52 AM, Jean-Baptiste Onofré <[hidden email]> wrote:

Did you set append on the edit ?

Regards
JB

On 07/06/2018 21:47, Alex Soto wrote:
Hello,

Using Karaf 4.2.0, I want to update a property in my custom
distribution. So I add file /src/main/karaf/assembly-property-edits.xml/
with: 

   <edit>
       <file>org.ops4j.pax.web.cfg</file>
       <operation>put</operation>
       <key>org.osgi.service.http.port</key>
       <value>8182</value>
   </edit>


The result is:

   #Modified by org.apache.karaf.tools.utils.KarafPropertiesFile
   #Thu Jun 07 15:39:28 EDT 2018
   org.osgi.service.http.port=8182



The issue is that it erased all other properties.  Normally, this file
has the following:

   org.osgi.service.http.port=8181
   javax.servlet.context.tempdir=${karaf.data}/pax-web-jsp
   org.ops4j.pax.web.config.file=${karaf.etc}/jetty.xml



Is this the expected behavior?   How can I preserve the rest of the
properties and modify just one?

Best regards,
Alex soto



--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com






Francois Papon
Openrun : https://www.openrun.re
Reply | Threaded
Open this post in threaded view
|

Re: Karaf assembly plugin property edits erasing properties

jbonofre
In reply to this post by Alex Soto
Sorry I meant prepend because it could change the reading of the property.

It seems like a regression in 4.2.0.

I created https://issues.apache.org/jira/browse/KARAF-5781

On the other hand, I also created
https://issues.apache.org/jira/browse/KARAF-5782 to verify the create
kar goal behavior.

I gonna work on this during the week end.

Regards
JB

On 08/06/2018 17:29, Alex Soto wrote:

> Append?  No, I've never seen this documented anywhere, can you point me
> to a documentation resource where this is mentioned/illustrated?
>
> Best regards,
> Alex soto
>
>
>
>
>> On Jun 8, 2018, at 8:52 AM, Jean-Baptiste Onofré <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>> Did you set append on the edit ?
>>
>> Regards
>> JB
>>
>> On 07/06/2018 21:47, Alex Soto wrote:
>>> Hello,
>>>
>>> Using Karaf 4.2.0, I want to update a property in my custom
>>> distribution. So I add file /src/main/karaf/assembly-property-edits.xml/
>>> with: 
>>>
>>>    <edit>
>>>        <file>org.ops4j.pax.web.cfg</file>
>>>        <operation>put</operation>
>>>        <key>org.osgi.service.http.port</key>
>>>        <value>8182</value>
>>>    </edit>
>>>
>>>
>>> The result is:
>>>
>>>    #Modified by org.apache.karaf.tools.utils.KarafPropertiesFile
>>>    #Thu Jun 07 15:39:28 EDT 2018
>>>    org.osgi.service.http.port=8182
>>>
>>>
>>>
>>> The issue is that it erased all other properties.  Normally, this file
>>> has the following:
>>>
>>>    org.osgi.service.http.port=8181
>>>    javax.servlet.context.tempdir=${karaf.data}/pax-web-jsp
>>>    org.ops4j.pax.web.config.file=${karaf.etc}/jetty.xml
>>>
>>>
>>>
>>> Is this the expected behavior?   How can I preserve the rest of the
>>> properties and modify just one?
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> [hidden email] <mailto:[hidden email]>
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com