Hi all,

I've the following script (inside the container)

-rwxr-xr-x 1 casisp casisp 103 May 22 22:58 user-add

/opt/apache-karaf/bin/client "jaas:realm-manage --index 1; jaas:user-add user1 
password1; jaas:update"

When I'm calling it from the command line directly it works.

Inside a route (see below) it returns an exit code 1. Any thoughts about this?

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
           https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>

        <camelContext xmlns="http://camel.apache.org/schema/blueprint";>

                <route>
                        <from uri="timer:exec?repeatCount=1" />
                        <setHeader name="CamelExecCommandExecutable">
                                
<constant>/opt/apache-karaf/bin/user-add</constant>
                        </setHeader>
                        <to uri="exec://dummy-target" />
                        <log message="headers: ${in.headers}" />
                </route>

        </camelContext>

</blueprint>

2020-05-23T05:28:44,039 | INFO  | Blueprint Event Dispatcher: 1 | 
AbstractCamelContext             | 94 - org.apache.camel.camel-base - 3.3.0 | 
Route: route37 started and consuming from: timer://exec
2020-05-23T05:28:44,067 | INFO  | Blueprint Event Dispatcher: 1 | 
AbstractCamelContext             | 94 - org.apache.camel.camel-base - 3.3.0 | 
Total 1 routes, of which 1 are started
2020-05-23T05:28:44,068 | INFO  | Blueprint Event Dispatcher: 1 | 
AbstractCamelContext             | 94 - org.apache.camel.camel-base - 3.3.0 | 
Apache Camel 3.3.0 (CamelContext: camel-35) started in 0.223 seconds
2020-05-23T05:28:44,088 | INFO  | fileinstall-/opt/apache-karaf-4.2.8/deploy | 
fileinstall                      | 10 - org.apache.felix.fileinstall - 3.6.4 | 
Started bundle: blueprint:file:/opt/apache-karaf-4.2.8/deploy/exec.xml
2020-05-23T05:28:50,553 | INFO  | sshd-SshServer[242a1ef6]-nio2-thread-1 | 
ServerUserAuthService            | 38 - org.apache.sshd.core - 1.7.0 | Session 
admin@/127.0.0.1:50158 authenticated
2020-05-23T05:28:51,697 | ERROR | Camel (camel-35) thread #67 - timer://exec | 
ExecProducer                     | 109 - org.apache.camel.camel-exec - 3.3.0 | 
The command ExecCommand [args=[], executable=/opt/apache-karaf/bin/user-add, 
timeout=9223372036854775807, outFile=null, workingDir=null, 
commandLogLevel=DEBUG, useStderrOnEmptyStdout=false] returned exit value 1
2020-05-23T05:28:51,697 | INFO  | Camel (camel-35) thread #67 - timer://exec | 
route37                          | 102 - org.apache.camel.camel-core-engine - 
3.3.0 | headers: {CamelExecExitValue=1, 
CamelExecStderr=java.io.ByteArrayInputStream@6d4d91bc, firedTime=Sat May 23 
05:28:45 UTC 2020}
 

Best
- Gerald

Reply via email to