vcsrepo type, svn, & ensure => latest

457 views
Skip to first unread message

Michael Knox

unread,
Jul 13, 2010, 2:12:21 AM7/13/10
to Puppet Users

Hi all,
We have some data in SVN repos and I'd like puppet to ensure that a) the
latest copy is checked out, and b) reload a service if it is updated.
So I've configured the vcsrepo type
(http://forge.puppetlabs.com/puppetlabs/vcsrepo).

However when I subscribe to the vcsrepo resource, it is always
refreshed, irrespective of whether the repository is upto date or not.
I'd prefer not to reload the service everytime puppet runs on the client.

My test manifest ...

vcsrepo { "/tmp/repo":
ensure => latest,
provider => svn,
source => "svn+ssh://me@host/repo",
}

exec {"/bin/date":
subscribe => Vcsrepo["/tmp/repo"],
}

Does anyone have any suggestions on how I can get this to only refresh
when the repo is updated?
I've tried looking at how it is done in the file and package types, but
my ruby/puppet architecture knowledge is not yet upto that.

Thanks

James Turnbull

unread,
Jul 13, 2010, 11:13:05 AM7/13/10
to puppet...@googlegroups.com, Puppet Users
Michael

Can you provide logs so I can see what's happening --debug please.

Thanks

James Turnbull

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

Michael Knox

unread,
Jul 13, 2010, 4:58:06 PM7/13/10
to puppet...@googlegroups.com
James,

On 14/07/10 1:13 AM, James Turnbull wrote:
> Michael
>
> Can you provide logs so I can see what's happening --debug please.
>
Client debug log attached. There was nothing on the puppetmaster (also
--debug).
puppet-vcsrepo.debug

bmort

unread,
Jul 14, 2010, 9:03:35 AM7/14/10
to Puppet Users
Micheal,

What directory and what file name did you put your test mainifest in?



On Jul 13, 2:12 am, Michael Knox <michael.knox...@gmail.com> wrote:
> Hi all,
> We have some data in SVN repos and I'd like puppet to ensure that a) the
> latest copy is checked out, and b) reload a service if it is updated.
> So I've configured thevcsrepotype
> (http://forge.puppetlabs.com/puppetlabs/vcsrepo).
>
> However when I subscribe to thevcsreporesource, it is always

nate

unread,
Jul 14, 2010, 9:11:05 AM7/14/10
to Puppet Users
at the risk of sounding dense here, is it updating because the result
of /bin/date is always going to be unique? maybe you can trigger it
some other way, like with a comparison.

On Jul 13, 2:12 am, Michael Knox <michael.knox...@gmail.com> wrote:

nate

unread,
Jul 14, 2010, 9:17:30 AM7/14/10
to Puppet Users
never mind… haven't had coffee yet.

Mike

unread,
Jul 14, 2010, 4:47:00 PM7/14/10
to Puppet Users
Bort

On Jul 14, 11:03 pm, bmort <propertywholesa...@gmail.com> wrote:
> Micheal,
>
> What directory and what file name did you put your test mainifest in?
>
The I have puppet-vcsrepo (which is simply a git clone from the repo)
in my $$modulepath.
Then in my test env I have that test manifest below in site.pp. This
test env is only for playing with vcsrepo.

In the env I'm building the vcsrepo types are declared in the
relevant manifests. In this case my DNS management module as we have
all the zone files in SVN.

Corey Ralph

unread,
Jul 14, 2010, 8:35:37 PM7/14/10
to puppet...@googlegroups.com
Hi Michael,

On 13/07/2010, at 4:12 PM, Michael Knox wrote:

exec {"/bin/date":
    subscribe =>  Vcsrepo["/tmp/repo"],
}

Does anyone have any suggestions on how I can get this to only refresh
when the repo is updated?

You need to add refreshonly => true to that exec.

Cheers
Corey

Michael Knox

unread,
Jul 14, 2010, 9:50:34 PM7/14/10
to puppet...@googlegroups.com
Thanks Corey,
Tried adding that, but it didn't make any difference. The issue is when puppet is processing the vcsrepo type, and before it processes the exec type (in this test, in production it will be a service).

From the log ...
notice: //Vcsrepo[/tmp/repo]/ensure: ensure changed 'present' to 'latest'
info: //Vcsrepo[/tmp/repo]: Scheduling refresh of Exec[/bin/date]

Vcsrepo has scheduled a refresh of the Exec when it shouldn't have (IMO), i.e. the svn checkout was already upto date and therefore hadn't changed.

Cheers
Mike

Michael Knox

unread,
Jul 15, 2010, 10:36:56 PM7/15/10
to puppet...@googlegroups.com
ok,
So I think I now have it sorted ...
I've added an insync? method to the type to override the inherited
method, as well as making some tweaks in the svn provider.
Seems to work correctly now with svn so I'll tidy up my code and submit
a patch/diff.

Cheers

James Turnbull

unread,
Jul 15, 2010, 11:11:42 PM7/15/10
to puppet...@googlegroups.com
Michael Knox wrote:
> ok,
> So I think I now have it sorted ...
> I've added an insync? method to the type to override the inherited
> method, as well as making some tweaks in the svn provider.
> Seems to work correctly now with svn so I'll tidy up my code and submit
> a patch/diff.

Michael

Yes I thought that would be the issue - the same problem existed in the
Git provider. Was intending to look at the code but other things came up.

Happy to take patches.

Thanks

James Turnbull

--
Puppet Labs - http://www.puppetlabs.com
C: 503-734-8571

Michael Knox

unread,
Jul 16, 2010, 2:24:00 AM7/16/10
to puppet...@googlegroups.com
Well to wrap this up, I've created a diff and submitted to the puppet-dev list (https://groups.google.com/group/puppet-dev/browse_thread/thread/6f6735933f362892?hl=en#).

Code is available at http://github.com/mikeknox/puppet-vcsrepo/tree/bug/svn-update.


Cheers
Mike

Reply all
Reply to author
Forward
0 new messages