Notifies script

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

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 <
jasonjwwilliams@gmail.com> 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

That makes sense. Thanks for the help and heads up.

-J

On Thu, Jun 23, 2011 at 7:15 PM, Sascha Bates sascha.bates@gmail.com wrote:

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
jasonjwwilliams@gmail.com 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