Did you try using an update resource, and a build resource, where the second depends on the first?

i.e. something like

exec { 'repository_update':
  command => 'git pull',
}
exec { 'build':
  command => 'make',
  require => Exec['repository_update']
}

or, if you prefer:

exec { 'repository_update':
  command => 'git pull',
}
exec { 'build':
  command => 'make',
}

Exec['build'] -> Exec['repository_update']

- henrik

On 2012-09-10 13:12, Adrian Webb wrote:
Hello,

I've been trying to implement a puppet definition that uses vcsrepo and
notifies the caller through an update_notify parameter when the
repository contents change on disk.  I have however found this very hard
to accomplish.

Basically I am trying to pull down a git repo and when the head of the
repo changes on the disk of the agent, run a build command (such as
make) into a release directory.  So the system automatically tracks a
branch or responds to changes in tags and the system automatically
builds off of that information.  In order to allow for multiple types of
build processes I am trying to notify other resources through the exec
notify property.

My problem is this:

The only way to trigger the notification in a conditional manner that I
have found is to use the onlyif or unless properties on the exec
resource.  Notifications still happen on the exec command even if the
command fails so I can not use an inline command to notify or not (that
I know of).  But the onlyif property which I have been trying seems to
execute before any of the actual commands so it always runs before the
vcsrepo update, which voids the intended purpose.  I can not use
functions with a conditional because they are only run on puppet master
and also suffer from the same issue where they run before any commands,
and I can not use a fact because I need a directory parameter and it is
also runs before any of the commands.

So I need a way to conditionally trigger a notify during the course of a
execution run right after the vcsrepo gets done pulling down any
updates.  Does anyone know how I might accomplish this task through
puppet?  So far nothing I have tried works.  I would think that this
goal would not be that isolated (building a repository after and only
after repository updates).  In my case I normally build into release
directories so absolutely can not afford to rebuild on every puppet
execution which runs every 5 minutes.

Thanks for any help you can provide!

Adrian

--
You received this message because you are subscribed to the Google
Groups "Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/NNQsDH1nox8J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to