[chef] Re: Notifies script


Chronological Thread 
  • From: Sascha Bates < >
  • To:
  • Subject: [chef] Re: Notifies script
  • Date: Thu, 23 Jun 2011 20:15:51 -0500
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=JrHL3HsbJnKuzauyTStkcFXwYYHVi5u8JAuXhK7WWXjFvm4B/HvSmPyh8Bd4bxpfp0 EUsRMPKNBzTVZhQtF9CF8ERQxVZ+F8Smc5qjIOz33Bjg+4SGXcXTQ2QfDSlScrKIzimd DNyuP2VdZ/KuLetRrsCPlRGYwxEjn4/emOT7E=

We've been doing stuff like this.  (don't laugh).  Honestly though, we've pretty much weeded out almost every last bit of bash we can or abstracted it with definitions.  I wrote that log message in hopes that the maintainers of our systems will see it and some day actually offer me a known good file (I haven't been able to find two that look alike).

bash "update_pamd" do
   code <<-EOH
    #{pamsed1}
    #{pamsed2}
  EOH
  action :nothing
end

log "Checking to see if pam.d/system-auth needs updating.  We are using sed because no definitive system-auth file has been provided to use as a template." do
  level :info
  notifies :run, "bash[update_pamd]"
  not_if "grep 'use_authtok md5' /etc/pam.d/system-auth"
end

It looks like this if the file needs no updating:
[Thu, 23 Jun 2011 20:04:06 -0500] DEBUG: Ran grep 'use_authtok md5' /etc/pam.d/system-auth returned 0
[Thu, 23 Jun 2011 20:04:06 -0500] DEBUG: Skipping log[Checking to see if pam.d/system-auth needs updating.  We are using sed because no definitive system-auth file has been provided to use as a template.] due to not_if


this what it looks like when it does update:
[Thu, 23 Jun 2011 20:14:33 -0500] INFO: log[Checking to see if pam.d/system-auth needs updating.  We are using sed because no definitive system-auth file has been provided to use as a template.] sending run action to bash[update_pamd] (delayed)
[Thu, 23 Jun 2011 20:14:33 -0500] INFO: Ran bash[update_pamd] successfully

On Thu, Jun 23, 2011 at 7:53 PM, Jason J. W. Williams < "> > wrote:
Is it possible to use "notifies" on a resource to run a script
resource? I basically only want to run the script resource if the git
resource deploys a new version.

-J




Archive powered by MHonArc 2.6.16.

§