First, I would alsways use isexecutable("/path/file") over a shell command test -x, then try something like this:

vars:

 freebsd::

  "check_service" string => "/usr/local/libexec/tenant/check_mysql";

 linux::

  "check_service" string => "/usr/local/lib/tenant/check_mysql";

classes:

   "ok_to_check" expression => isexecutable("$(check_service)");

 ok_to_check::

 "CheckMysql" expression => returnszero("$(check_service)");



On 05/20/2011 11:11 PM, dave first wrote:
Hey Folks,

One of our engineers wrote a promise a while back to create a class in promises.cf <http://promises.cf> given the outcome of an expression...

classes:

"CheckMysql" expression => returnszero("/bin/test -x /usr/local/libexec/tenant/check_tenant -a ! -x /usr/local/libexec/tenant/check_mysql","useshell");

The problem is, when this promise was written, there was only one OS being monitored by Cfengine. Now we have several OS's being monitored, and none of the paths in the promise will match for any but one OS. Errors abound in the logs saying can't find "/usr/local/libexec/tenant/check_tenant" and can't find "/bin/test".

How do I define a class for only one OS?

Thanks,
Dave


_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to