ReturnsZero函数在CFEngine中存在,但是没有ReturnsNotZero。
如果我确实需要根据命令的非零返回值定义一个类,我应该做什么?
CFEngine2中的示例是首选的,但是CFEngine3很好:-)
用于CFEngine2的示例
(我认为在任何正式文件中都找不到。我花了大约半个小时才在CFEngine2的源代码中找到这个技巧)
classes:
has_python27 = ( ReturnsZero(/usr/bin/which python27) )
no_python27 = ( !ReturnsZero(/usr/bin/which python27) )希望这对拉加西CFEngine的人有帮助
用于CFEngine3的示例
请阅读以下的答案:-)
发布于 2012-06-19 13:39:11
使用CFEngine 3,您只需对来自returnszero()的结果使用not
classes:
"someclass" not => returnszero("/some/command");https://stackoverflow.com/questions/11093940
复制相似问题