>>>>> Francois Papon <francois.pa...@openobject.fr>:

> May be you can run Karaf console commands using the ssh client in the
> docker compose ? (I did not try this before and I'm interesting to know
> if it work's ;)

With the help off sshpass, this works for simple one-liners, like
"feature:install ukelonn".

First install sshpass (and, of course ssh)
 apt-get install openssh-client sshpass

One line commands like this works:
 sb@lorenzo:~$ sshpass -p karaf ssh -p 8101 karaf@localhost 'feature:repo-add 
mvn:no.priv.bang.sonar.sonar-collector/sonar-collector-webhook/LATEST/xml/features'
 Password authentication
 Adding feature url 
mvn:no.priv.bang.sonar.sonar-collector/sonar-collector-webhook/LATEST/xml/features
 sb@lorenzo:~$ sshpass -p karaf ssh -p 8101 karaf@localhost 'feature:install 
sonar-collector-webhook'
 Password authentication
 sb@lorenzo:~$

However, this approach fails on the multi line commands like the config edit:
 sb@lorenzo:~$ sshpass -p karaf ssh -p 8101 karaf@localhost 'config:edit 
org.ops4j.pax.url.mvn'
 Password authentication
 sb@lorenzo:~$ sshpass -p karaf ssh -p 8101 karaf@localhost 
'config:property-append org.ops4j.pax.url.mvn.repositories ", 
https://maven.bang.priv.no/repository/@id=ukelonn@snapshots, 
http://maven.vaadin.com/vaadin-addons@id=vaadin";'
 Password authentication
 No configuration is being edited--run the edit command first
 sb@lorenzo:~$

Of course, the /etc/karaf/org.ops4j.pax.url.mvn.cfg file could be edited
directly with a sed script...

I will try both this approach and JB's approach and see what works best.

Thanks!

Reply via email to