- From: Wes Morgan <
>
- To:
- Subject: [chef] Re: Re: deleting objects from the chef server when deleted from git repo
- Date: Wed, 14 Nov 2012 15:31:49 -0700
On Nov 14, 2012, at 3:14 PM, Peter Donald
<
>
wrote:
>
Hi,
>
>
On Thu, Nov 15, 2012 at 8:11 AM, Wes Morgan
>
<
>
>
wrote:
>
> I finally got around to setting up a Jenkins job to upload changes to the
>
> Chef server when I push them to the git repo. So far it's *great* having
>
> one source of truth for my Chef data.
>
>
>
> However, the one remaining hole is deleting things from the Chef server
>
> when they're deleted from the git repo. Is anyone already doing that in an
>
> automated fashion? If so, what is your favorite approach?
>
>
We actually use a fancy bit of ruby script using the spice gem that
>
does uploads, deletes and runs a bunch of auditing and validation
>
functions on the chef server. I have heard people have also done
>
something similar with jclouds but never looked into it.
>
>
However a quick and dirty script may work just as well. Something like
>
>
knife cookbook list | awk '{print $1}' | sort > server.txt
>
ls cookbooks | sort > local.txt
>
diff server.txt local.txt | grep '<' | awk '{print $2}' | xargs
>
--verbose knife cookbook delete -y
Brilliant, thanks.
Running this made me remember that cookbooks aren't segregated by
organization in hosted Chef, so this would delete things that I don't want to
delete. Hmm, maybe this needs some more thought. I think deletes would have
to be triggered via git log parsing to get around that.
>
>
>
--
>
Cheers,
>
>
Peter Donald
Archive powered by MHonArc 2.6.16.