如何测试功能是否安装在 karaf 控制台脚本中? [英] How to test if a feature is installed in a karaf console script?

查看:28
本文介绍了如何测试功能是否安装在 karaf 控制台脚本中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个卸载功能的 karaf 控制台脚本(如果 karaf 3.0.4 上存在该功能).

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

到目前为止,我还没有在文档(https://karaf.apache.org/manual/latest-3.0.x/developers-guide/scripting.html).使用 shell:env ? 总是返回 null 作为值,我不确定 ? 是否是 karaf 中支持的环境变量名称.

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.

那么如果存在特征,如何执行 karaf 命令?

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

推荐答案

无法测试功能是否安装在 3.0.4 版的 karaf 控制台脚本中.这是因为 范围feature 不向控制台返回任何内容(请参阅 源代码).

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).

解决方法是部署另一个命令 到 karaf 返回一个布尔值到控制台并在脚本中使用它.

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

这篇关于如何测试功能是否安装在 karaf 控制台脚本中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆