Forum: Cfengine Help
Subject: Re: Running a command just once.
Author: jeromebaum
Link to topic: https://cfengine.com/forum/read.php?3,21797,21800#msg-21800

Was just working on a config today. Part of it was "create a database w/ its 
tables, add some stored procedures, import a development snapshot dump" but 
only if this wasn't already done (obviously). How do you do that in a 
convergent fashion?

So:


1. Create database
2. Import schema
3. Import stored procedures
4. Import a dump


All of these only if necessary. I can see handling #1 -- just check if the 
database exists. #2 dito, #3 would be a bit more hard but I guess dito. #4 is 
the troublesome thing. How do I know if "the dump has been imported" in a clean 
fashion? Check if there is "some data" in the DB? What if it was partially 
applied? etc.

I think using a flag file sounds fine. Yes, if it's deleted then re-running the 
script should bring it back to an expected state, not break it. But yes, the 
flag file sounds good to prevent starting a long-running script, or something.

What's your take? Is cfengine the wrong tool to import the dump? This, btw, is 
for provisioning a devel workstation.

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

Reply via email to