Forum: Cfengine Help
Subject: ifrepaired/usebundle?
Author: usernotfound
Link to topic: https://cfengine.com/forum/read.php?3,21820,21820#msg-21820

I'm trying to use cfengine to provision logical volumes based on a list of 
courses.  As you can see in this example code below, I have seperate promises 
to create the directories needed, and to set the permissions/group.  




bundle agent courseserverlvm{

vars:
        courseserver:

                "course" slist => {"EAS221", "EAS391", "EAS434", 
"EAS533","EAS536","EAS591U","EAS636","eas116ta","EAS221Y",
                        
"EAS432","EAS523","EAS535","EAS591C","EAS631","bluemrbl","eas226"};


files:
       courseserver::


                ####Let's make the directory structure and create lv's if need 
be####
                "/export/classes/$(course)/."
                        #shit, something goes here that means "if repaired, use 
bundle(createlvm($(class)))"
                        create => "true";

                ####Let's set the permissions####

                "/export/classes/$(course)/."
                        perms => mg("700","$course");            

}

bundle agent createlvm(lvNAME){
commands:
      "/bin/commandtocreatelvm $(lvNAME)"
}


My first thought was for the  promise  "/export/classes/$(course)/."   to 
define a class if repaired, but that adds the machine to the class, and doesn't 
pass the list item that I need in to use in the command.

Next, I thought i could do a usebundle => createlvm($(course)), as I can 
clearly pass variables, but i have no idea how to implement the logic "if 
repaired then usebundle(createlvm($(class)))"

Any idea to help guide me to how to execute commands for only the file: 
promises that are repaired?

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

Reply via email to