You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by SvS <Du...@solcon.nl> on 2018/02/21 16:39:26 UTC

Problems with using configurations in custom distribution.

I try to create a custom distribution with modified configuration files and
see the following problems:

1. Modifications of the configuration (with profiles and also
KarafPropertyEdits)  are overwritten with the configuration part (<config>..
.</config>)  defined in the feature file. I assume that's not the intention.
(See  code Builder
<https://github.com/apache/karaf/blob/8e6649f2bd6754bf280ff1d6ddf279543f2c250e/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java#L924> 
). It is impossible to change the configuration with the
karaf-maven-plugin:assembly for a custom distribution;
2. Would not it be nice when the configuration files <configfile
finalname=mvn ..../> also placed in the etc directory of the custom
distribution? Same as the internal configuration specified in the feature
files (and not only installed to the system directory). Than other tools can
use those files directly after copy the distribution to the production
environment.

Environment:
•	Windows 7;
•	Karaf 4.1.5;

Problems also available in 4.2.0.M2 and 4.1.0 – 4.1.5.

Will I make incidents or am I wrong?




-----
Regards,
SvS
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: Problems with using configurations in custom distribution.

Posted by SvS <Du...@solcon.nl>.
Hi Francois,

To use the resources plugin is always an option, but it is not so powerful
(for a custom distribution) as a karaf profile or property edits. Property
edits and profiles works fine in karaf version 4.0.9, but not in the
versions 4.1.0 - 4.1.5 or 4.2.0.M2.

Regards,
SvS.



-----
Regards,
SvS
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: Problems with using configurations in custom distribution.

Posted by Francois Papon <fr...@openobject.fr>.
Hi,

You can put a file named assembly-property-edits.xml in the
src/main/karaf of the assembly module of your custom distribution.

the operation put update an existing value and extend add a new value in
the file specified by the file tag.

exemple of file :

<?xml version="1.0" encoding="UTF-8"?>
<!--
     * Specify an XML file that instructs this goal to apply edits to
     * one or more standard Karaf property files.
     * The contents of this file are documented in detail on
     * <a href="karaf-property-instructions-model.html">this page</a>.
     * This allows you to
     * customize these files without making copies in your resources
     * directories. Here's a simple example:
     * <pre>
     * -->
      <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>

you can also include file in the resource directory (etc for example)
using the maven-resources-plugin by puting file in the
src/main/resources of the assemby module of your distribution :

    <!-- if you want to include resources in the distribution -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.2</version>
                <executions>
                    <execution>
                        <id>process-resources</id>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>



Francois

Le 21/02/2018 à 20:39, SvS a écrit :
> I try to create a custom distribution with modified configuration files and
> see the following problems:
>
> 1. Modifications of the configuration (with profiles and also
> KarafPropertyEdits)  are overwritten with the configuration part (<config>..
> .</config>)  defined in the feature file. I assume that's not the intention.
> (See  code Builder
> <https://github.com/apache/karaf/blob/8e6649f2bd6754bf280ff1d6ddf279543f2c250e/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java#L924> 
> ). It is impossible to change the configuration with the
> karaf-maven-plugin:assembly for a custom distribution;
> 2. Would not it be nice when the configuration files <configfile
> finalname=mvn ..../> also placed in the etc directory of the custom
> distribution? Same as the internal configuration specified in the feature
> files (and not only installed to the system directory). Than other tools can
> use those files directly after copy the distribution to the production
> environment.
>
> Environment:
> •	Windows 7;
> •	Karaf 4.1.5;
>
> Problems also available in 4.2.0.M2 and 4.1.0 – 4.1.5.
>
> Will I make incidents or am I wrong?
>
>
>
>
> -----
> Regards,
> SvS
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html


Re: Problems with using configurations in custom distribution.

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Oh sorry, I missed the github notification.

Let me resume the review tonight.

Thanks !
Regards
JB

On 17/07/2018 16:52, SvS wrote:
> Hi JB,
> 
> I have also given an answer. See  PR 553
> <https://github.com/apache/karaf/pull/553>  . Is this enough? Do you not
> receive a notification?
> 
> 
> 
> -----
> Regards, 
> SvS
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Problems with using configurations in custom distribution.

Posted by SvS <Du...@solcon.nl>.
Hi JB,

I have also given an answer. See  PR 553
<https://github.com/apache/karaf/pull/553>  . Is this enough? Do you not
receive a notification?



-----
Regards, 
SvS
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: Problems with using configurations in custom distribution.

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

I set myself as reviewer on the PRs and already provided some feedback.

I'm just waiting for your feedback following my comments.

Regards
JB

On 17/07/2018 11:47, SvS wrote:
> Hi JB,
> 
> This is not the case at the moment. Only when <config/> is used, a file will
> appear in the etc. directory and not with <configfile/>.
> 
> As you have already seen, incidents and pull requests have been created.
> 
> KARAF-5781 <https://issues.apache.org/jira/browse/KARAF-5781>  : Properties
> edit doesn't conserve the existing ones.
> -  PR 552 <https://github.com/apache/karaf/pull/552>  : [KARAF-5781]
> Properties edit doesn't conserve the existing ones. (On master)
> -  PR 544 <https://github.com/apache/karaf/pull/544>  : [KARAF-5781]
> Properties edit doesn't conserve the existing ones. (On karaf-4.1.x)
> 
> KARAF-5810 <https://issues.apache.org/jira/browse/KARAF-5810>  : No config
> file installed in custom distribution.
> -  PR 553 <https://github.com/apache/karaf/pull/553>  : [KARAF-5810] No
> config file installed in custom distribution. (On master)  
> -  PR 554 <https://github.com/apache/karaf/pull/554>  : [KARAF-5810] No
> config file installed in custom distribution. (On karaf-4.1.x) 
> 
> The change requests have also been processed. Let me know if I can do
> anything. It would be nice if these change requests could be included in the
> next version (karaf 4.2.1).
> 
> 
> 
> -----
> Regards,
> SvS
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Problems with using configurations in custom distribution.

Posted by SvS <Du...@solcon.nl>.
Hi JB,

This is not the case at the moment. Only when <config/> is used, a file will
appear in the etc. directory and not with <configfile/>.

As you have already seen, incidents and pull requests have been created.

KARAF-5781 <https://issues.apache.org/jira/browse/KARAF-5781>  : Properties
edit doesn't conserve the existing ones.
-  PR 552 <https://github.com/apache/karaf/pull/552>  : [KARAF-5781]
Properties edit doesn't conserve the existing ones. (On master)
-  PR 544 <https://github.com/apache/karaf/pull/544>  : [KARAF-5781]
Properties edit doesn't conserve the existing ones. (On karaf-4.1.x)

KARAF-5810 <https://issues.apache.org/jira/browse/KARAF-5810>  : No config
file installed in custom distribution.
-  PR 553 <https://github.com/apache/karaf/pull/553>  : [KARAF-5810] No
config file installed in custom distribution. (On master)  
-  PR 554 <https://github.com/apache/karaf/pull/554>  : [KARAF-5810] No
config file installed in custom distribution. (On karaf-4.1.x) 

The change requests have also been processed. Let me know if I can do
anything. It would be nice if these change requests could be included in the
next version (karaf 4.2.1).



-----
Regards,
SvS
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: Problems with using configurations in custom distribution.

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

If it's not the case by default with <config/>, <configfile/> should goes into
the etc folder (if the finalname is correct of course, containing the local
filesystem). It should already be the case. Can you share your project
especially how to you create your profile and how do you use it ?

Thanks !
Regards
JB

On 02/21/2018 05:39 PM, SvS wrote:
> I try to create a custom distribution with modified configuration files and
> see the following problems:
> 
> 1. Modifications of the configuration (with profiles and also
> KarafPropertyEdits)  are overwritten with the configuration part (<config>..
> .</config>)  defined in the feature file. I assume that's not the intention.
> (See  code Builder
> <https://github.com/apache/karaf/blob/8e6649f2bd6754bf280ff1d6ddf279543f2c250e/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java#L924> 
> ). It is impossible to change the configuration with the
> karaf-maven-plugin:assembly for a custom distribution;
> 2. Would not it be nice when the configuration files <configfile
> finalname=mvn ..../> also placed in the etc directory of the custom
> distribution? Same as the internal configuration specified in the feature
> files (and not only installed to the system directory). Than other tools can
> use those files directly after copy the distribution to the production
> environment.
> 
> Environment:
> •	Windows 7;
> •	Karaf 4.1.5;
> 
> Problems also available in 4.2.0.M2 and 4.1.0 – 4.1.5.
> 
> Will I make incidents or am I wrong?
> 
> 
> 
> 
> -----
> Regards,
> SvS
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com