Hi, I'm using a set of promised to guarantee some magic words are poked into pseudo-files under /sys on linux. The following construct generates an error message (cosmetic only, but still annoying) when there are no disks found:-
vars: "vdisklist" string => execresult("<find_vdisks>", "noshell"); "virt_disk" slist => splitstring( ${vdisklist},"$(const.endl)","99"); "sched_$(virt_disk)" string => execresult("/bin/cat /sys/block/$(virt_disk)/queue/scheduler", "noshell"); classes: "noop_$(virt_disk)" expression => regcmp("^.*(\[noop\]|none).*$", "$(sched_$(virt_disk))"); commands: "/bin/echo noop > /sys/block/$(virt_disk)/queue/scheduler" contain => in_shell, ifvarclass => "!noop_$(virt_disk)"; The "<find_vdisks>" is just a long find command that returns a list of the devices I'm interested in. The point of this is to guarantee the scheduler type is set correctly, and my actual config is more complex, as it defines machine types. However, this test fragment generates the error message:- cf3> Q: ".../bin/echo noop ": sh: cannot create /sys/block//queue/scheduler: Directory nonexistent cf3> I: Last 1 quoted lines were generated by promiser "/bin/echo noop > /sys/block//queue/scheduler" My understanding of this was that if $(vdisklist) was an empty string, then $(virt_disk) would be an empty list, the regcmp would never match, and the commands promise would never run, as the ifvarclass would prevent is from working. However, what seems to be happening is that a class "noop_" gets defined even though the regcmp operation can't be matching, and then cfengine tries to execute a nonsensical commands promise. I've tried changing "expression" to "or" in the classes promise, but that broke it in other ways (this config fragment sets a different scheduler for real physical disks, and that stopped working). Can anyone explain why I'm seeing this behaviour, and what I can do to prevent it? Thanks, Mike _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine