Re: Scripting installation of features - Command not found: feature:repo-add (was Re: feature:repo-add -i broken in 4.0.4?)
Have you considered just making a karaf assembly? On Oct 8, 2016 11:22 AM, "emets...@gmail.com"wrote: > Hi Guillaume, > > After digging a bit more, the apparent disparity between the client and the > interactive console seems to be related to timing: > > bin/start && \ > bin/client -r 10 -d 5 "feature:repo-add -i > mvn:edu.amherst.acdc/acrepo-karaf/LATEST/xml/features" && \ > sleep 20 && \ > bin/stop > > Adding a `sleep` before stopping the console allows the bundles to be > started! I assumed that `feature:repo-add -i` was blocking until > everything > was installed, but I was mistaken? Or maybe calling bin/stop so quickly > aborts the preservation of the bundle state? > > In any case, adding the sleep is allowing everything to come up nicely. > > Thanks, > Elliot > > > > -- > View this message in context: http://karaf.922171.n3.nabble. > com/feature-repo-add-i-broken-in-4-0-4-tp4046143p4048280.html > Sent from the Karaf - User mailing list archive at Nabble.com. >
Re: Scripting installation of features - Command not found: feature:repo-add (was Re: feature:repo-add -i broken in 4.0.4?)
Hi Guillaume, After digging a bit more, the apparent disparity between the client and the interactive console seems to be related to timing: bin/start && \ bin/client -r 10 -d 5 "feature:repo-add -i mvn:edu.amherst.acdc/acrepo-karaf/LATEST/xml/features" && \ sleep 20 && \ bin/stop Adding a `sleep` before stopping the console allows the bundles to be started! I assumed that `feature:repo-add -i` was blocking until everything was installed, but I was mistaken? Or maybe calling bin/stop so quickly aborts the preservation of the bundle state? In any case, adding the sleep is allowing everything to come up nicely. Thanks, Elliot -- View this message in context: http://karaf.922171.n3.nabble.com/feature-repo-add-i-broken-in-4-0-4-tp4046143p4048280.html Sent from the Karaf - User mailing list archive at Nabble.com.
Re: Scripting installation of features - Command not found: feature:repo-add (was Re: feature:repo-add -i broken in 4.0.4?)
Hi Guillaume, Thanks for the reply! I'll look forward to 4.0.8. However, I have found some additional behavior regarding `feature:repo-add -i` documented below, showing that the command behaves differently when executed from the Karaf client (bin/client) vs the interactive console. Guillaume Nodet-2 wrote > The commands may not be available yet when the script is started. > I think this should be fixed in 4.0.8. I attempted a work around: 1) Start Karaf 2) Use the client to connect and install the features For example: bin/start && \ bin/client -r 10 -d 5 "feature:repo-add -i mvn:edu.amherst.acdc/acrepo-karaf/LATEST/xml/features" && \ bin/stop However, there does not seem to be parity between `feature:repo-add -i` when executed from the Karaf client, vs execution from the interactive Karaf console. When `feature:repo-add -i` is executed by the client in a non-interactive fashion (per my example above), features will be in the 'STARTED' state, but their bundles will be in the 'INSTALLED' state (https://goo.gl/7mnYxG). When `feature:repo-add -i` is executed from the interactive Karaf console, features will be in the 'STARTED' state, AND the bundles will be in the 'ACTIVE' state (https://goo.gl/S87ThA). I wanted to bring this to your attention in case it can be addressed for 4.0.8. Best, Elliot -- View this message in context: http://karaf.922171.n3.nabble.com/feature-repo-add-i-broken-in-4-0-4-tp4046143p4048279.html Sent from the Karaf - User mailing list archive at Nabble.com.
Re: Scripting installation of features - Command not found: feature:repo-add (was Re: feature:repo-add -i broken in 4.0.4?)
The commands may not be available yet when the script is started. I think this should be fixed in 4.0.8. In the main time, you can try with the following script: loadclass = { (($.context bundle 0) loadClass $1) } dosleep = { longClass = (((loadclass java.lang.Long) getField "TYPE") get null) threadClass = (loadclass java.lang.Thread) sleepMethod = ($threadClass getMethod "sleep" $longClass) $sleepMethod invoke null $1 } not = { if $1 { false } { true } } wait-for-command = { while { not { $.commands contains $1 } } { dosleep 50 } } // this first sleep is needed in order to ensure that the if and while command are available dosleep 500 wait-for-command "feature:repo-add" feature:repo-add -i mvn:edu.amherst.acdc/acrepo-karaf/LATEST/xml/features Cheers, Guillaume 2016-09-26 22:37 GMT+02:00 emets...@gmail.com: > Hi, > > I've upgraded to Karaf 4.0.6, and I'm attempting to script the installation > of all features in a features repository, without having to enumerate each > feature. > > With the return of the '-i' argument to feature:repo-add, I've added the > following line to 'etc/shell.init.script': > feature:repo-add -i mvn:edu.amherst.acdc/acrepo-karaf/LATEST/xml/features > > After adding that line, I start the Karaf console and receive the following > error: > "Error in initialization script: Command not found: feature:repo-add" > > The command works when I copy and paste it into the Karaf console, but does > not work when appended to to 'etc/shell.init.script'. Do I mis-understand > the purpose or syntax of 'etc/shell.init.script', or is this a bug in > Karaf? > > Thanks again, > Elliot > > > > > -- > View this message in context: http://karaf.922171.n3.nabble. > com/feature-repo-add-i-broken-in-4-0-4-tp4046143p4048173.html > Sent from the Karaf - User mailing list archive at Nabble.com. > -- Guillaume Nodet Red Hat, Open Source Integration Email: gno...@redhat.com Web: http://fusesource.com Blog: http://gnodet.blogspot.com/
Scripting installation of features - Command not found: feature:repo-add (was Re: feature:repo-add -i broken in 4.0.4?)
Hi, I've upgraded to Karaf 4.0.6, and I'm attempting to script the installation of all features in a features repository, without having to enumerate each feature. With the return of the '-i' argument to feature:repo-add, I've added the following line to 'etc/shell.init.script': feature:repo-add -i mvn:edu.amherst.acdc/acrepo-karaf/LATEST/xml/features After adding that line, I start the Karaf console and receive the following error: "Error in initialization script: Command not found: feature:repo-add" The command works when I copy and paste it into the Karaf console, but does not work when appended to to 'etc/shell.init.script'. Do I mis-understand the purpose or syntax of 'etc/shell.init.script', or is this a bug in Karaf? Thanks again, Elliot -- View this message in context: http://karaf.922171.n3.nabble.com/feature-repo-add-i-broken-in-4-0-4-tp4046143p4048173.html Sent from the Karaf - User mailing list archive at Nabble.com.