I talk in the system.properties of the child instance.

Regards
JB

On 06/12/2015 11:09 AM, Gábor Lipták wrote:
Hi,

Does not work. If you take a look at the
https://github.com/apache/karaf/blob/60b284e4611824aaf420dd64f3c2d4d7dec56d61/instance/src/main/java/org/apache/karaf/jpm/impl/ScriptUtils.java,
it does execute instances with this code:
public static int execute(String name, Map<String, String> props) throws
IOException {
File script = File.createTempFile("jpm.", ".script");
try {
if (isWindows()) {
String res = "windows/" + name + ".vbs";
ScriptUtils.copyFilteredResource(res, script, props);
return executeProcess(new java.lang.ProcessBuilder("cscript",
   "/NOLOGO",
   "//E:vbs",
   script.getCanonicalPath()));
} else {
String res = "unix/" + name + ".sh";
ScriptUtils.copyFilteredResource(res, script, props);
return executeProcess(new java.lang.ProcessBuilder("/bin/sh",
   script.getCanonicalPath()));
}
} finally {
script.delete();
}
}

The environment for a forked process could be set with
http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html#environment()
method. This is however not used in the code above. The sh file, which
will be executed is at
https://github.com/apache/karaf/blob/60b284e4611824aaf420dd64f3c2d4d7dec56d61/instance/src/main/resources/org/apache/karaf/jpm/impl/unix/start.sh.
It also does not contain anything related. So I think this is not
possible today.

Is it a good feature request candidate? :)

Regards,

Gábor

2015-06-12 10:39 GMT+02:00 Jean-Baptiste Onofré <[email protected]
<mailto:[email protected]>>:

    Hi,

    I meant, that in Pax-Exam, you do:

         @Configuration
         public Option[] config() {
             Option[] options = new Option[]{
    ...

    editConfigurationFileExtend("instances/foo/etc/system.properties",
    "foo.bar", System.getEnv("foo.bar")),
             };
    ...
             return options;
         }

    Regards
    JB

    On 06/12/2015 10:33 AM, Gábor Lipták wrote:

        Hi Jean-Baptiste,

        Thanks for the prompt answer. I checked what you said. I created an
        instance and started it. The system.properties contains such
        stuff for
        example:
        karaf.name <http://karaf.name> <http://karaf.name> = node3
        karaf.default.repository = system

        However when I list the env entries with the following command:
          >cat /proc/PID/environ

        None of the properties set inside system.properties are displayed. I
        need environment entries, not system properties.

        Thanks and kind regards,

        Gábor


        2015-06-12 10:20 GMT+02:00 Jean-Baptiste Onofré <[email protected]
        <mailto:[email protected]>
        <mailto:[email protected] <mailto:[email protected]>>>:

             Hi Gabor,

             you can update the etc/system.properties of the child
        instance where
             you define the environment entry.

             Regards
             JB

             On 06/12/2015 10:17 AM, Gábor Lipták wrote:

                 Hi,

                 I have a problem (see
        http://stackoverflow.com/q/30791369/337621):

                 I am testing a clustering solution for Felix with Pax
        Exam and Karaf
                 (see
        
http://planet.jboss.org/post/advanced_integration_testing_with_pax_exam_karaf).
                 I start up several Karaf instances and play with them
        in the test.

                 If I want to be sure that the Karaf instances will be
        stopped in
                 Jenkins
                 when my test is aborted for some reason then I need to
        set some
                 environment entries for the forked containers (see How
        to fork a
                 background process in Jenkins? Setting BUILD_ID and
        using nohup
                 seems to
                 be non working) Is there a way to do so? I can set
        system properties
                 with the admin:create command option called --java-opts
        but I
                 cannot set
                 any environment entry for the forked process. Do you
        know any way or
                 trick to set them?

                 Any help appreciated. Do you think this is a good
        improvement
                 for the
                 admin service? Should I create a JIRA for it?

                 Regards,

                 Gábor Lipták


             --
             Jean-Baptiste Onofré
        [email protected] <mailto:[email protected]>
        <mailto:[email protected] <mailto:[email protected]>>
        http://blog.nanthrax.net
             Talend - http://www.talend.com



    --
    Jean-Baptiste Onofré
    [email protected] <mailto:[email protected]>
    http://blog.nanthrax.net
    Talend - http://www.talend.com



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

Reply via email to