On Fri, 18 May 2012 15:17:12 -0400 Ted Zlatanov <t...@lifelogs.com> wrote: 

TZ> cfsketch itself will make it possible to activate this multiple times,
TZ> so you don't have to deal with passing a 2-level array to describe
TZ> multiple repositories.

TZ> Although it will only support Git for now, I'm leaving the door open to
TZ> support other VCSs, including Subversion and even CVS.  They are still
TZ> out there :)

OK, pushed to https://github.com/tzz/design-center.git

I've been working on these conversions for a few sketches already, but
this was a good exercise on a brand-new sketch and I found a bug in
cfsketch.pl.  So it was a good couple of hours :)

Use like this (note you may need a bunch of Perl modules to run cfsketch.pl):

    git clone https://github.com/tzz/design-center.git

    cd design-center/external_tools/cfsketch

    # install the COPBL and the vcs_freshclone sketch
    ./cfsketch.pl --repolist=/var/tmp/cf-sketch.repo/ --install=./copbl 
--install=../../utilities/vcs_freshclone

    # activate vcs_freshclone with the CFEngine core Git repository
    # note you can do this many times with different JSON parameters!!!
    ./cfsketch.pl --activate VCS::vcs_freshclone 
--params=../../utilities/vcs_freshclone/params/cfengine-core.json 
--repolist=/var/tmp/cf-sketch.repo

    # generate runme.cf and run it
    ./cfsketch.pl --repolist=/var/tmp/cf-sketch.repo --generate 
    cf-agent -KI -f ./runme.cf

The generated runme.cf is below...  Let me know what you think!  And thanks!

Ted

body common control
{
      bundlesequence => { "g", "cfsketch_run" };
      inputs => { "/var/tmp/cf-sketch.repo/CFEngine/stdlib/cfengine_stdlib.cf", 
"/var/tmp/cf-sketch.repo/VCS/vcs_freshclone/main.cf" };
}

bundle common g
{
  classes:


 
      "_001_VCS__vcs_freshclone__activated" expression => "any";
 


  vars:


 
      "_001_VCS__vcs_freshclone__branch" string => "master";
 
      "_001_VCS__vcs_freshclone__origin" string => 
"https://github.com/cfengine/core.git";;
 
      "_001_VCS__vcs_freshclone__path" string => "/tmp/cfengine-core";
 
      "_001_VCS__vcs_freshclone__vcs" string => "/usr/bin/git";
 


}

bundle agent cfsketch_run
{
  methods:

    _001_VCS__vcs_freshclone__activated::
      "001 VCS::vcs_freshclone 
../../utilities/vcs_freshclone/params/cfengine-core.json" usebundle => 
vcs_freshclone("g._001_VCS__vcs_freshclone__");

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

Reply via email to