Forum: CFEngine Help
Subject: Re: Problems with ifvarclass
Author: sauer
Link to topic: https://cfengine.com/forum/read.php?3,23354,23359#msg-23359

Are you using a new version of Cfengine?  I seem to recall having some issues 
with the CF_NULL entry in slists not always getting purged in older (as in, 
prior to 3.1.5) releases.  So instead of skipping an empty element in a list, 
I'd end up having one iteration with an empty element.  In this situation, 
though, your command might also be emitting a newline when it doesn't find any 
results.  I'd check for that.  If you can't prune blank lines from the 
command's output, you might try using splitting into a temp list and then using 
the grep function to pull out only entries which match \w+.

In any case, I'd be inclined to define an additional class like 
"hasfile_$(virt_disk)" based on the result of a fileexists expression, and use 
that in the ifvarclass line to make sure you only operate if the file exists - 
or base directory, whichever is apporopriate.

I'd also be inclined to use the readfile function instead of putting cat inside 
of an execresult, BTW. ;)

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

Reply via email to