From dbac767ab7b0a6b7c70341774e237b5daca24c36 Mon Sep 17 00:00:00 2001 From: Cody Herriges Date: Tue, 3 Jul 2012 15:20:42 -0700 Subject: Add default user to run git as. Add a default to the user parameter of root, which is the user that the git commands would have ran in previously versions of this module. Without this an upgrade to the lastest release would cause syntax error all over a person's code base and provide no benefit. --- lib/puppet/type/vcsrepo.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/puppet/type/vcsrepo.rb b/lib/puppet/type/vcsrepo.rb index 352f439..4fab79e 100644 --- a/lib/puppet/type/vcsrepo.rb +++ b/lib/puppet/type/vcsrepo.rb @@ -135,6 +135,7 @@ Puppet::Type.newtype(:vcsrepo) do newparam :user do desc "The user to run for repository operations" + defaultto 'root' end newparam :excludes do -- cgit v1.2.3 From d4f68c2b28e08158b53e3f7606c94de7481bc74a Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Wed, 29 Aug 2012 00:20:34 +0200 Subject: Removes trailing whitespace --- README.markdown | 4 ++-- lib/puppet/provider/vcsrepo/bzr.rb | 2 +- lib/puppet/provider/vcsrepo/cvs.rb | 11 +++++------ lib/puppet/provider/vcsrepo/svn.rb | 4 ++-- lib/puppet/type/vcsrepo.rb | 4 ++-- spec/support/filesystem_helpers.rb | 2 +- spec/support/fixture_helpers.rb | 1 - spec/support/provider_example_group.rb | 6 +++--- spec/unit/puppet/provider/vcsrepo/bzr_spec.rb | 2 +- spec/unit/puppet/provider/vcsrepo/cvs_spec.rb | 24 ++++++++++++------------ spec/unit/puppet/provider/vcsrepo/hg_spec.rb | 22 +++++++++++----------- spec/unit/puppet/provider/vcsrepo/svn_spec.rb | 6 +++--- 12 files changed, 43 insertions(+), 45 deletions(-) diff --git a/README.markdown b/README.markdown index 33fddcb..823e044 100644 --- a/README.markdown +++ b/README.markdown @@ -11,9 +11,9 @@ This type can be used to describe: * A working copy checked out from a (remote or local) source, at an arbitrary revision * A "blank" working copy not associated with a source (when it makes - sense for the VCS being used) + sense for the VCS being used) * A "blank" central repository (when the distinction makes sense for the VCS - being used) + being used) Supported Version Control Systems --------------------------------- diff --git a/lib/puppet/provider/vcsrepo/bzr.rb b/lib/puppet/provider/vcsrepo/bzr.rb index 3a93e35..f9d58e2 100644 --- a/lib/puppet/provider/vcsrepo/bzr.rb +++ b/lib/puppet/provider/vcsrepo/bzr.rb @@ -26,7 +26,7 @@ Puppet::Type.type(:vcsrepo).provide(:bzr, :parent => Puppet::Provider::Vcsrepo) def destroy FileUtils.rm_rf(@resource.value(:path)) end - + def revision at_path do current_revid = bzr('version-info')[/^revision-id:\s+(\S+)/, 1] diff --git a/lib/puppet/provider/vcsrepo/cvs.rb b/lib/puppet/provider/vcsrepo/cvs.rb index 85178f1..5cdcfb8 100644 --- a/lib/puppet/provider/vcsrepo/cvs.rb +++ b/lib/puppet/provider/vcsrepo/cvs.rb @@ -6,7 +6,7 @@ Puppet::Type.type(:vcsrepo).provide(:cvs, :parent => Puppet::Provider::Vcsrepo) optional_commands :cvs => 'cvs' defaultfor :cvs => :exists has_features :gzip_compression, :reference_tracking, :modules - + def create if !@resource.value(:source) create_repository(@resource.value(:path)) @@ -28,12 +28,12 @@ Puppet::Type.type(:vcsrepo).provide(:cvs, :parent => Puppet::Provider::Vcsrepo) def working_copy_exists? File.directory?(File.join(@resource.value(:path), 'CVS')) end - + def destroy FileUtils.rm_rf(@resource.value(:path)) end - def latest? + def latest? debug "Checking for updates because 'ensure => latest'" at_path do # We cannot use -P to prune empty dirs, otherwise @@ -44,10 +44,10 @@ Puppet::Type.type(:vcsrepo).provide(:cvs, :parent => Puppet::Provider::Vcsrepo) return is_current end end - + def latest # CVS does not have a conecpt like commit-IDs or change - # sets, so we can only have the current branch name (or the + # sets, so we can only have the current branch name (or the # requested one, if that differs) as the "latest" revision. should = @resource.value(:revision) current = self.revision @@ -117,5 +117,4 @@ Puppet::Type.type(:vcsrepo).provide(:cvs, :parent => Puppet::Provider::Vcsrepo) set_ownership end end - end diff --git a/lib/puppet/provider/vcsrepo/svn.rb b/lib/puppet/provider/vcsrepo/svn.rb index bd420b5..85c5089 100644 --- a/lib/puppet/provider/vcsrepo/svn.rb +++ b/lib/puppet/provider/vcsrepo/svn.rb @@ -41,7 +41,7 @@ Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo) end end end - + def buildargs args = ['--non-interactive'] if @resource.value(:basic_auth_username) && @resource.value(:basic_auth_password) @@ -58,7 +58,7 @@ Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo) svn(*args)[/^Last Changed Rev:\s+(\d+)/m, 1] end end - + def revision args = buildargs.push('info') at_path do diff --git a/lib/puppet/type/vcsrepo.rb b/lib/puppet/type/vcsrepo.rb index 352f439..4b53235 100644 --- a/lib/puppet/type/vcsrepo.rb +++ b/lib/puppet/type/vcsrepo.rb @@ -21,7 +21,7 @@ Puppet::Type.newtype(:vcsrepo) do feature :ssh_identity, "The provider supports a configurable SSH identity file" - + feature :user, "The provider can run as a different user" @@ -167,7 +167,7 @@ Puppet::Type.newtype(:vcsrepo) do newparam :identity, :required_features => [:ssh_identity] do desc "SSH identity file" end - + newparam :module, :required_features => [:modules] do desc "The repository module to manage" end diff --git a/spec/support/filesystem_helpers.rb b/spec/support/filesystem_helpers.rb index 08345b4..15e2ca7 100644 --- a/spec/support/filesystem_helpers.rb +++ b/spec/support/filesystem_helpers.rb @@ -3,7 +3,7 @@ module FilesystemHelpers def expects_chdir(path = resource.value(:path)) Dir.expects(:chdir).with(path).at_least_once.yields end - + def expects_mkdir(path = resource.value(:path)) Dir.expects(:mkdir).with(path).at_least_once end diff --git a/spec/support/fixture_helpers.rb b/spec/support/fixture_helpers.rb index 7b7b20a..205715c 100644 --- a/spec/support/fixture_helpers.rb +++ b/spec/support/fixture_helpers.rb @@ -3,5 +3,4 @@ module FixtureHelpers def fixture(name, ext = '.txt') File.read(File.join(File.dirname(__FILE__), '..', 'fixtures', name.to_s + ext)) end - end diff --git a/spec/support/provider_example_group.rb b/spec/support/provider_example_group.rb index 2a8865f..1431f78 100644 --- a/spec/support/provider_example_group.rb +++ b/spec/support/provider_example_group.rb @@ -14,7 +14,7 @@ class ProviderExampleGroup < Spec::Example::ExampleGroup # Build the provider subject { described_class.new(@resource) } - + # Allow access to it via +provider+ alias :provider :subject @@ -47,14 +47,14 @@ class ProviderExampleGroup < Spec::Example::ExampleGroup context("and with a #{text}", {:resource => placeholders}, &block) end end - + def self.build_value_context(params = {}, &block) #:nodoc: unless params.empty? text = params.map { |k, v| "#{k} => #{v.inspect}" }.join(' and with ') context("and with #{text}", {:resource => params}, &block) end end - + # Generate a context for a provider operating on a resource without # a given parameter/property. diff --git a/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb b/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb index f073b8e..6c66ef4 100644 --- a/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb @@ -78,7 +78,7 @@ describe_provider :vcsrepo, :bzr, :resource => {:path => '/tmp/vcsrepo'} do end end end - + describe "setting the revision property" do it "should use 'bzr update -r' with the revision" do revision = 'somerev' diff --git a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb index cc195eb..9bae8ae 100644 --- a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb @@ -11,24 +11,24 @@ describe_provider :vcsrepo, :cvs, :resource => {:path => '/tmp/vcsrepo'} do provider.expects(:cvs).with('-d', resource.value(:source), 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source))) provider.expects(:cvs).with('update', '-r', resource.value(:revision), '.') provider.create - end + end end - + resource_without :revision do it "should just execute 'cvs checkout' without a revision" do provider.expects(:cvs).with('-d', resource.value(:source), 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source))) provider.create - end + end end - + context "with a compression", :resource => {:compression => '3'} do it "should just execute 'cvs checkout' without a revision" do provider.expects(:cvs).with('-d', resource.value(:source), '-z', '3', 'checkout', '-d', File.basename(resource.value(:path)), File.basename(resource.value(:source))) provider.create - end + end end end - + context "when a source is not given" do it "should execute 'cvs init'" do provider.expects(:cvs).with('-d', resource.value(:path), 'init') @@ -51,7 +51,7 @@ describe_provider :vcsrepo, :cvs, :resource => {:path => '/tmp/vcsrepo'} do provider.exists? end end - + resource_without :source do it "should check for the CVSROOT directory" do File.expects(:directory?).with(File.join(resource.value(:path), 'CVSROOT')) @@ -64,7 +64,7 @@ describe_provider :vcsrepo, :cvs, :resource => {:path => '/tmp/vcsrepo'} do before do @tag_file = File.join(resource.value(:path), 'CVS', 'Tag') end - + context "when CVS/Tag exists" do before do @tag = 'HEAD' @@ -75,22 +75,22 @@ describe_provider :vcsrepo, :cvs, :resource => {:path => '/tmp/vcsrepo'} do provider.revision.should == @tag end end - + context "when CVS/Tag does not exist" do before do File.expects(:exist?).with(@tag_file).returns(false) end it "assumes MAIN" do - provider.revision.should == 'MAIN' + provider.revision.should == 'MAIN' end end end - + describe "when setting the revision property" do before do @tag = 'SOMETAG' end - + it "should use 'cvs update -r'" do expects_chdir provider.expects('cvs').with('update', '-r', @tag, '.') diff --git a/spec/unit/puppet/provider/vcsrepo/hg_spec.rb b/spec/unit/puppet/provider/vcsrepo/hg_spec.rb index 6f32d44..e1287cf 100644 --- a/spec/unit/puppet/provider/vcsrepo/hg_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/hg_spec.rb @@ -11,17 +11,17 @@ describe_provider :vcsrepo, :hg, :resource => {:path => '/tmp/vcsrepo'} do resource.value(:source), resource.value(:path)) provider.create - end + end end - + resource_without :revision do it "should just execute 'hg clone' without a revision" do provider.expects(:hg).with('clone', resource.value(:source), resource.value(:path)) provider.create - end + end end end - + context "when a source is not given" do it "should execute 'hg init'" do provider.expects(:hg).with('init', resource.value(:path)) @@ -48,37 +48,37 @@ describe_provider :vcsrepo, :hg, :resource => {:path => '/tmp/vcsrepo'} do before do expects_chdir end - + context "when given a non-SHA as the resource revision" do before do provider.expects(:hg).with('parents').returns(fixture(:hg_parents)) provider.expects(:hg).with('tags').returns(fixture(:hg_tags)) end - + context "when its SHA is not different than the current SHA", :resource => {:revision => '0.6'} do it "should return the ref" do provider.revision.should == '0.6' end end - + context "when its SHA is different than the current SHA", :resource => {:revision => '0.5.3'} do it "should return the current SHA" do provider.revision.should == '34e6012c783a' - end + end end end context "when given a SHA as the resource revision" do before do provider.expects(:hg).with('parents').returns(fixture(:hg_parents)) end - + context "when it is the same as the current SHA", :resource => {:revision => '34e6012c783a'} do it "should return it" do provider.expects(:hg).with('tags').returns(fixture(:hg_tags)) provider.revision.should == resource.value(:revision) end end - + context "when it is not the same as the current SHA", :resource => {:revision => 'not-the-same'} do it "should return the current SHA" do provider.expects(:hg).with('tags').returns(fixture(:hg_tags)) @@ -87,7 +87,7 @@ describe_provider :vcsrepo, :hg, :resource => {:path => '/tmp/vcsrepo'} do end end end - + describe "setting the revision property" do before do @revision = '6aa99e9b3ab1' diff --git a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb b/spec/unit/puppet/provider/vcsrepo/svn_spec.rb index db4a4c7..5587d4c 100644 --- a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/svn_spec.rb @@ -11,7 +11,7 @@ describe_provider :vcsrepo, :svn, :resource => {:path => '/tmp/vcsrepo'} do resource.value(:source), resource.value(:path)) provider.create - end + end end resource_without :revision do it "should just execute 'svn checkout' without a revision" do @@ -19,7 +19,7 @@ describe_provider :vcsrepo, :svn, :resource => {:path => '/tmp/vcsrepo'} do resource.value(:source), resource.value(:path)) provider.create - end + end end end resource_without :source do @@ -63,7 +63,7 @@ describe_provider :vcsrepo, :svn, :resource => {:path => '/tmp/vcsrepo'} do provider.revision.should == '4' end end - + describe "setting the revision property" do before do @revision = '30' -- cgit v1.2.3 From 3975481f29ac1908b253365c9939f671459b5302 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Wed, 29 Aug 2012 00:24:15 +0200 Subject: Adds comma to last attribute to comply with style --- examples/bzr/branch.pp | 2 +- examples/bzr/init_repo.pp | 2 +- examples/cvs/local.pp | 4 ++-- examples/cvs/remote.pp | 2 +- examples/git/bare_init.pp | 2 +- examples/git/clone.pp | 2 +- examples/git/working_copy_init.pp | 2 +- examples/hg/clone.pp | 2 +- examples/hg/init_repo.pp | 2 +- examples/svn/checkout.pp | 3 +-- examples/svn/server.pp | 2 +- 11 files changed, 12 insertions(+), 13 deletions(-) diff --git a/examples/bzr/branch.pp b/examples/bzr/branch.pp index a24dbb5..0ed0705 100644 --- a/examples/bzr/branch.pp +++ b/examples/bzr/branch.pp @@ -2,5 +2,5 @@ vcsrepo { '/tmp/vcstest-bzr-branch': ensure => present, provider => bzr, source => 'lp:do', - revision => '1312' + revision => '1312', } diff --git a/examples/bzr/init_repo.pp b/examples/bzr/init_repo.pp index 36d2463..1129dd7 100644 --- a/examples/bzr/init_repo.pp +++ b/examples/bzr/init_repo.pp @@ -1,4 +1,4 @@ vcsrepo { '/tmp/vcstest-bzr-init': ensure => present, - provider => bzr + provider => bzr, } diff --git a/examples/cvs/local.pp b/examples/cvs/local.pp index c72652d..155742e 100644 --- a/examples/cvs/local.pp +++ b/examples/cvs/local.pp @@ -1,11 +1,11 @@ vcsrepo { '/tmp/vcstest-cvs-repo': ensure => present, - provider => cvs + provider => cvs, } vcsrepo { '/tmp/vcstest-cvs-workspace-local': ensure => present, provider => cvs, source => '/tmp/vcstest-cvs-repo', - require => Vcsrepo['/tmp/vcstest-cvs-repo'] + require => Vcsrepo['/tmp/vcstest-cvs-repo'], } diff --git a/examples/cvs/remote.pp b/examples/cvs/remote.pp index 990a580..eb9665a 100644 --- a/examples/cvs/remote.pp +++ b/examples/cvs/remote.pp @@ -1,5 +1,5 @@ vcsrepo { '/tmp/vcstest-cvs-workspace-remote': ensure => present, provider => cvs, - source => ':pserver:anonymous@cvs.sv.gnu.org:/sources/leetcvrt' + source => ':pserver:anonymous@cvs.sv.gnu.org:/sources/leetcvrt', } diff --git a/examples/git/bare_init.pp b/examples/git/bare_init.pp index f16d137..4166f6e 100644 --- a/examples/git/bare_init.pp +++ b/examples/git/bare_init.pp @@ -1,4 +1,4 @@ vcsrepo { '/tmp/vcstest-git-bare': ensure => bare, - provider => git + provider => git, } diff --git a/examples/git/clone.pp b/examples/git/clone.pp index b7d5bfb..b29a4fd 100644 --- a/examples/git/clone.pp +++ b/examples/git/clone.pp @@ -1,5 +1,5 @@ vcsrepo { '/tmp/vcstest-git-clone': ensure => present, provider => git, - source => 'git://github.com/bruce/rtex.git' + source => 'git://github.com/bruce/rtex.git', } diff --git a/examples/git/working_copy_init.pp b/examples/git/working_copy_init.pp index b20af20..e3352eb 100644 --- a/examples/git/working_copy_init.pp +++ b/examples/git/working_copy_init.pp @@ -1,4 +1,4 @@ vcsrepo { '/tmp/vcstest-git-wc': ensure => present, - provider => git + provider => git, } diff --git a/examples/hg/clone.pp b/examples/hg/clone.pp index 92b3335..be2d955 100644 --- a/examples/hg/clone.pp +++ b/examples/hg/clone.pp @@ -2,5 +2,5 @@ vcsrepo { '/tmp/vcstest-hg-clone': ensure => present, provider => hg, source => 'http://hg.basho.com/riak', - revision => 'riak-0.5.3' + revision => 'riak-0.5.3', } diff --git a/examples/hg/init_repo.pp b/examples/hg/init_repo.pp index 52aba4c..a890804 100644 --- a/examples/hg/init_repo.pp +++ b/examples/hg/init_repo.pp @@ -1,4 +1,4 @@ vcsrepo { '/tmp/vcstest-hg-init': ensure => present, - provider => hg + provider => hg, } diff --git a/examples/svn/checkout.pp b/examples/svn/checkout.pp index 1fceb7b..f9fc273 100644 --- a/examples/svn/checkout.pp +++ b/examples/svn/checkout.pp @@ -1,6 +1,5 @@ vcsrepo { '/tmp/vcstest-svn-checkout': ensure => present, provider => svn, - source => 'http://svn.edgewall.org/repos/babel/trunk' + source => 'http://svn.edgewall.org/repos/babel/trunk', } - diff --git a/examples/svn/server.pp b/examples/svn/server.pp index eaf6b27..de7c390 100644 --- a/examples/svn/server.pp +++ b/examples/svn/server.pp @@ -1,4 +1,4 @@ vcsrepo { '/tmp/vcstest-svn-server': ensure => present, - provider => svn + provider => svn, } -- cgit v1.2.3 From f3fc00d0c8ba1664b82e44e3d881f93da5504bd2 Mon Sep 17 00:00:00 2001 From: Joshua Harlan Lifton Date: Thu, 18 Oct 2012 17:10:23 -0700 Subject: Fix links to documentation and update LICENSE Previous to this commit the documentation and license files referred to Reductive Labs and docs.reductivelabs.com. This commit updates those files to refer to Puppet Labs and docs.puppetlabs.com. --- LICENSE | 4 ++-- README.BZR.markdown | 2 +- README.CVS.markdown | 2 +- README.GIT.markdown | 2 +- README.HG.markdown | 2 +- README.SVN.markdown | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/LICENSE b/LICENSE index a8de5fe..2ee80c8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ -Copyright (C) 2010 Reductive Labs Inc. +Copyright (C) 2010-2012 Puppet Labs Inc. -Reductive Labs can be contacted at: info@reductivelabs.com +Puppet Labs can be contacted at: info@puppetlabs.com This program and entire repository is free software; you can redistribute it and/or modify it under the terms of the GNU diff --git a/README.BZR.markdown b/README.BZR.markdown index dd610db..cc257e9 100644 --- a/README.BZR.markdown +++ b/README.BZR.markdown @@ -44,4 +44,4 @@ More Examples For examples you can run, see `examples/bzr/` -[1]: http://docs.reductivelabs.com/references/stable/metaparameter.html#require +[1]: http://docs.puppetlabs.com/references/stable/metaparameter.html#require diff --git a/README.CVS.markdown b/README.CVS.markdown index 321c865..10121a7 100644 --- a/README.CVS.markdown +++ b/README.CVS.markdown @@ -53,4 +53,4 @@ More Examples For examples you can run, see `examples/cvs/` -[1]: http://docs.reductivelabs.com/references/stable/metaparameter.html#require +[1]: http://docs.puppetlabs.com/references/stable/metaparameter.html#require diff --git a/README.GIT.markdown b/README.GIT.markdown index b63d90b..95a9bc3 100644 --- a/README.GIT.markdown +++ b/README.GIT.markdown @@ -66,5 +66,5 @@ More Examples For examples you can run, see `examples/git/` -[1]: http://docs.reductivelabs.com/references/stable/metaparameter.html#require +[1]: http://docs.puppetlabs.com/references/stable/metaparameter.html#require diff --git a/README.HG.markdown b/README.HG.markdown index 55ac88f..b1680c8 100644 --- a/README.HG.markdown +++ b/README.HG.markdown @@ -52,4 +52,4 @@ More Examples For examples you can run, see `examples/hg/` -[1]: http://docs.reductivelabs.com/references/stable/metaparameter.html#require +[1]: http://docs.puppetlabs.com/references/stable/metaparameter.html#require diff --git a/README.SVN.markdown b/README.SVN.markdown index 3dc852f..489f5bf 100644 --- a/README.SVN.markdown +++ b/README.SVN.markdown @@ -44,4 +44,4 @@ More Examples For examples you can run, see `examples/svn/` -[1]: http://docs.reductivelabs.com/references/stable/metaparameter.html#require +[1]: http://docs.puppetlabs.com/references/stable/metaparameter.html#require -- cgit v1.2.3 From d300f9aed15f1ef72a2c26e213f8672ae6a708cb Mon Sep 17 00:00:00 2001 From: Eric Hayes Date: Tue, 3 Jul 2012 13:58:40 -0400 Subject: Updated git documentation --- README.GIT.markdown | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.GIT.markdown b/README.GIT.markdown index b63d90b..6ddf99c 100644 --- a/README.GIT.markdown +++ b/README.GIT.markdown @@ -53,6 +53,25 @@ For a specific revision or branch (can be a commit SHA, tag or branch name): source => 'git://example.com/repo.git', revision => 'development' } + +Check out as a user: + + vcsrepo { "/path/to/repo": + ensure => present, + provider => git, + source => 'git://example.com/repo.git', + revision => '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31', + user => 'someUser' + } + +Keep the repository at the latest revision (note: this will always overwrite local changes to the repository): + + vcsrepo { "/path/to/repo": + ensure => latest, + provider => git, + source => 'git://example.com/repo.git', + revision => 'master', + } For sources that use SSH (eg, `username@server:...`) ---------------------------------------------------- -- cgit v1.2.3