Feature configurations do not update existing property as part of etc

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Feature configurations do not update existing property as part of etc

yogu13
Hi,

I noticed that the below configuration added as part of my custom feature does not have any effect if etc/com.foo.bar.cfg has myProperty already defined. I was hoping i could use the config to update a property which is already defined and available

<config name="com.foo.bar">
  myProperty = myValue
</config>

I stumbled across this scenario when i wanted to reset aries.transaction.recoverable to false which is now turned on (set to true) by default in karaf.

In case config updation is not supported by config tag can this support be added ?

Let me know.. I can try and provide a PR

Regards,
-Yogesh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Feature configurations do not update existing property as part of etc

Achim Nierbeck
Hi Yogesh,

you only can append existing configurations, but not replace. [1]
This is by design, as already existing files can't be differentiate
between, already accustomed or needs to be "patched".

Regards, Achim

[1] -
https://github.com/apache/karaf/blob/master/features/core/src/main/resources/org/apache/karaf/features/karaf-features-1.4.0.xsd#L194


2017-04-08 19:29 GMT+02:00 yogu13 <[hidden email]>:

> Hi,
>
> I noticed that the below configuration added as part of my custom feature
> does not have any effect if etc/com.foo.bar.cfg has myProperty already
> defined. I was hoping i could use the config to update a property which is
> already defined and available
>
> <config name="com.foo.bar">
>   myProperty = myValue
> </config>
>
> I stumbled across this scenario when i wanted to reset
> aries.transaction.recoverable to false which is now turned on (set to true)
> by default in karaf.
>
> In case config updation is not supported by config tag can this support be
> added ?
>
> Let me know.. I can try and provide a PR
>
> Regards,
> -Yogesh
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.
> com/Feature-configurations-do-not-update-existing-property-
> as-part-of-etc-tp4050074.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>



--

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Feature configurations do not update existing property as part of etc

yogu13
Hello Achim,

Thank you for your reply..

But does the group feel such a feature would be useful ? If yes then i can try to provide a fix.

Right now I am not able to achieve automation and instead have a manual step (of editing the transaction file) after deploying my custom KAR. If this feature is implemented it could help in scenarios like I am facing. However implementing this feature has its downside as well especially since multiple KAR files can be deployed into Karaf and each KAR can end up toggling the properties.

Regards,
-Yogesh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Feature configurations do not update existing property as part of etc

jbonofre
In reply to this post by Achim Nierbeck
Hi,

if you use <confgfile/> instead of <config/>, you can use the override flag.

I think it makes sense to support override  flag for the <config/> element as it
now creates the cfg file.

I will create a Jira about that.

Regards
JB

On 04/09/2017 10:25 PM, Achim Nierbeck wrote:

> Hi Yogesh,
>
> you only can append existing configurations, but not replace. [1]
> This is by design, as already existing files can't be differentiate
> between, already accustomed or needs to be "patched".
>
> Regards, Achim
>
> [1] -
> https://github.com/apache/karaf/blob/master/features/core/src/main/resources/org/apache/karaf/features/karaf-features-1.4.0.xsd#L194
>
>
> 2017-04-08 19:29 GMT+02:00 yogu13 <[hidden email]>:
>
>> Hi,
>>
>> I noticed that the below configuration added as part of my custom feature
>> does not have any effect if etc/com.foo.bar.cfg has myProperty already
>> defined. I was hoping i could use the config to update a property which is
>> already defined and available
>>
>> <config name="com.foo.bar">
>>   myProperty = myValue
>> </config>
>>
>> I stumbled across this scenario when i wanted to reset
>> aries.transaction.recoverable to false which is now turned on (set to true)
>> by default in karaf.
>>
>> In case config updation is not supported by config tag can this support be
>> added ?
>>
>> Let me know.. I can try and provide a PR
>>
>> Regards,
>> -Yogesh
>>
>>
>>
>> --
>> View this message in context: http://karaf.922171.n3.nabble.
>> com/Feature-configurations-do-not-update-existing-property-
>> as-part-of-etc-tp4050074.html
>> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>>
>
>
>

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

Re: Feature configurations do not update existing property as part of etc

jbonofre
In reply to this post by yogu13
As said, as a workaround, you can use <configfile/> with override.

Regards
JB

On 04/10/2017 06:34 AM, yogu13 wrote:

> Hello Achim,
>
> Thank you for your reply..
>
> But does the group feel such a feature would be useful ? If yes then i can
> try to provide a fix.
>
> Right now I am not able to achieve automation and instead have a manual step
> (of editing the transaction file) after deploying my custom KAR. If this
> feature is implemented it could help in scenarios like I am facing. However
> implementing this feature has its downside as well especially since multiple
> KAR files can be deployed into Karaf and each KAR can end up toggling the
> properties.
>
> Regards,
> -Yogesh
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Feature-configurations-do-not-update-existing-property-as-part-of-etc-tp4050074p4050084.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>

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

Re: Feature configurations do not update existing property as part of etc

yogu13
Hello JB,

Thats correct <configfile/> should work, I tried it but as far as i recollect it didn't work, I will try and update you with the actual reason for why it didnt work ( I do not remember it as its been few days :( ). Also we do not consider this as optimal solution for us as we will have to maintain a copy of aries transaction file and keep upgrading incase of any additions / updates to the original file provided by aries.


Thank you for raising the JIRA ticket!

Regards,
-Yogesh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Feature configurations do not update existing property as part of etc

yogu13
echoing what i mentioned as part of JIRA

considering override="true" needs to be added, config element also supports append="true". Just wondering using append="true" and override="true" together would make any sense?

<config name="com.foo.bar" append="true" override="true">
myProperty = myValue
</config>
With above as an example would it mean if myProperty is found it would get overwritten with value as "myValue" and if the property is not found then gets appended to the config file.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Feature configurations do not update existing property as part of etc

jbonofre
Hi,

no, override will take the lead on append.

Regards
JB

On 04/15/2017 08:26 PM, yogu13 wrote:

> echoing what i mentioned as part of JIRA
>
> considering override="true" needs to be added, config element also supports
> append="true". Just wondering using append="true" and override="true"
> together would make any sense?
>
> <config name="com.foo.bar" append="true" override="true">
> myProperty = myValue
> </config>
> With above as an example would it mean if myProperty is found it would get
> overwritten with value as "myValue" and if the property is not found then
> gets appended to the config file.
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Feature-configurations-do-not-update-existing-property-as-part-of-etc-tp4050074p4050162.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>

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