There's ReturnsZero
function in CFEngine
but there's no ReturnsNotZero
.
If I do need to define a class depending on non-zero return value of a command, what should I do?
Examples in CFEngine2
is preferred but CFEngine3
is fine :-)
Example for CFEngine2
( which I don't think it can be found in any official document. It takes me about half an hour to find this trick in CFEngine2
's source code )
classes:
has_python27 = ( ReturnsZero(/usr/bin/which python27) )
no_python27 = ( !ReturnsZero(/usr/bin/which python27) )
Hope this helps someone with lagacy CFEngine
Example for CFEngine3
Please read zzamboni's answer below :-)