How to test if a feature is installed in a karaf console script?

笑着哭i 提交于 2019-12-25 06:38:34

问题


I need to write a karaf console script that uninstalls a feature, if it is present on karaf 3.0.4.

So far I have not found any direct references mentionend in the documentation (https://karaf.apache.org/manual/latest-3.0.x/developers-guide/scripting.html). Using shell:env ? always returns null as the value and I'm not sure if ? is a supported environment variable name in karaf.

So how can execute a karaf command if a feature is present?


回答1:


It is not possible to test if a feature is installed in a karaf console script in version 3.0.4. This is because the commands for scope feature do not return anything to the console (see the source code).

The workaround is to deploy another command to karaf that returns a boolean to the console and use this in a script.



来源:https://stackoverflow.com/questions/32076009/how-to-test-if-a-feature-is-installed-in-a-karaf-console-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!