Ask Your Question
0

puppetlabs/vcsrepo git submodule update without exec

asked 2013-08-06 13:40:27 -0500

sritchie gravatar image

updated 2013-08-08 13:33:57 -0500

Looking for a better way to update a git submodule using the puppetlabs/vcsrepo module.

Using a (ops-maintained) git repo for puppet files in /etc/puppetlabs/puppet, and a (dev-maintained) submodule in /etc/puppetlabs/puppet/files/appconf.

The following is written to use a submodule, but using exec seems like a kludge.

  vcsrepo { '/etc/puppetlabs/puppet/':
    ensure   => latest,
    user     => $username,
    provider => git,
    require  => [ Package["git"] ],
    source   => "git@git.mydomain.com:${repo}.git",
    revision => 'master',
  }
  ->
  exec { '/usr/bin/git submodule init':
    cwd => '/etc/puppetlabs/puppet',
  }
  ->
  exec { '/usr/bin/git submodule update':
    cwd => '/etc/puppetlabs/puppet',
  }

Thanks!

-s

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-08-08 13:32:03 -0500

sritchie gravatar image

My code was not actually keeping the submodule up-to-date.

I've since pulled the submodule out and am treating it as a separate repo, in a move toward librarian (or r10k) workflow:

https://ask.puppetlabs.com/question/2280/puppet-environments-using-git/

Thanks,

-s

edit flag offensive delete link more
0

answered 2013-08-06 22:29:36 -0500

GregLarkin gravatar image

At the very least, you should be able to remove the 1st exec resource above. The vcsrepo code calls git submodule update --init --recursive, which if I understand the git submodule documentation correctly, is roughly equivalent to your 1st exec resource.

However, after poring through the vcsrepo code further, I didn't see it call git submodule update --recursive, so your 2nd exec still needs to be there. If your use case is common enough, maybe that argues for a patch to the vcsrepo module to support an "update_submodules" attribute that ensures git submodule update is called as well.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-08-06 13:40:27 -0500

Seen: 1,123 times

Last updated: Aug 08 '13