Forum: CFEngine Help Subject: Re: split user passwd array Author: sauer Link to topic: https://cfengine.com/forum/read.php?3,24257,24656#msg-24656
My approach is to have CFEngine manage the whole passwd file, and then any user changes happen directly in the CFEngine policy. That makes this whole problem more simple. Well, it's more simple if you ignore the complexity of writing a tool to programmatically edit the existing CFEngine policy, anyway. ;) But to answer your question, the variable problably isn't being set because of the werid pre-parsing that determines when variables will exist and whatnot. The array probably doesn't exist until the second pass through the policy, and the report has laready been generated by then. Presuming that's the case, you can usually solve that by setting some of the variables in a separate bundle, and then using methods to sequence the "set vars" bundle before the "do stuff with the vars" bundle. I've started just doing that as standard practice if I'm doing anything moderately complicated with vars (particularly when using modules or when using functions which define extra vars through side effects), as it completely removes a lot of "why isn't this var set yet" issues. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine