Skip to content

Update specs and fix FM-1361 #145

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
May 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ group :development, :test do
gem 'rake', :require => false
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-system', :require => false
gem 'rspec-system-puppet', :require => false
gem 'rspec-system-serverspec', :require => false
gem 'serverspec', :require => false
gem 'puppet-lint', :require => false
gem 'pry', :require => false
Expand Down
9 changes: 4 additions & 5 deletions lib/puppet/provider/vcsrepo/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@
has_features :bare_repositories, :reference_tracking, :ssh_identity, :multiple_remotes, :user, :depth

def create
if @resource.value(:revision) and @resource.value(:ensure) == :bare
fail("Cannot set a revision (#{@resource.value(:revision)}) on a bare repository")
end
if !@resource.value(:source)
init_repository(@resource.value(:path))
else
clone_repository(@resource.value(:source), @resource.value(:path))
if @resource.value(:revision)
if @resource.value(:ensure) == :bare
notice "Ignoring revision for bare repository"
else
checkout
end
checkout
end
if @resource.value(:ensure) != :bare
update_submodules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

teardown do
on(host, "rm -fr #{tmpdir}")
on(host, "ps ax | grep '#{ruby} #{tmpdir}/#{http_server_script}' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
on(host, "ps ax | grep '#{ruby} #{tmpdir}/#{http_server_script}' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1")
end

step 'checkout with puppet using basic auth' do
Expand All @@ -52,8 +52,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

teardown do
on(host, "rm -fr #{tmpdir}")
on(host, "ps ax | grep '#{ruby} #{tmpdir}/#{http_server_script}' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
on(host, "ps ax | grep '#{ruby} #{tmpdir}/#{http_server_script}' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1")
end

step 'checkout with puppet using basic auth' do
Expand All @@ -60,8 +60,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

teardown do
on(host, "rm -fr #{tmpdir}")
on(host, 'pkill -9 git-daemon')
on(host, 'pkill -9 git-daemon ; sleep 1')
end

step 'checkout with puppet using basic auth' do
Expand All @@ -36,8 +36,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout (silent error for basic auth using git protocol)" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout is on the #{branch} branch" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout is on the #{branch} branch" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

teardown do
on(host, "rm -fr #{tmpdir}")
on(host, 'pkill -9 git-daemon')
on(host, 'pkill -9 git-daemon ; sleep 1')
end

step 'checkout a branch with puppet' do
Expand All @@ -32,8 +32,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout is on the #{branch} branch" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

teardown do
on(host, "rm -fr #{tmpdir}")
on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1")
end

step 'checkout a branch with puppet' do
Expand All @@ -40,8 +40,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout is on the #{branch} branch" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

teardown do
on(host, "rm -fr #{tmpdir}")
on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1")
end

step 'checkout a branch with puppet' do
Expand All @@ -47,8 +47,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout is on the #{branch} branch" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@
end
step 'setup - establish ssh keys' do
# create ssh keys
on(host, 'ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')
on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')

# copy public key to authorized_keys
on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys')
on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config')
on(host, 'chown -R root:root /root/.ssh')
end

teardown do
on(host, "rm -fr #{tmpdir}")
apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }")
apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }")
apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", :catch_failures => true)
apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", :catch_failures => true)
end

step 'checkout a branch with puppet' do
Expand All @@ -37,8 +38,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout is on the #{branch} branch" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@
end
step 'setup - establish ssh keys' do
# create ssh keys
on(host, 'ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')
on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')

# copy public key to authorized_keys
on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys')
on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config')
on(host, 'chown -R root:root /root/.ssh')
end

teardown do
on(host, "rm -fr #{tmpdir}")
apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }")
apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }")
apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", :catch_failures => true)
apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", :catch_failures => true)
end

step 'checkout a branch with puppet' do
Expand All @@ -37,8 +38,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout is on the #{branch} branch" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :expect_failures => true)
end

step 'verify that master branch is checked out' do
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/beaker/git/clone/clone_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout is on the master branch" do
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/beaker/git/clone/clone_file_path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout is on the master branch" do
Expand Down
6 changes: 3 additions & 3 deletions spec/acceptance/beaker/git/clone/clone_git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

teardown do
on(host, "rm -fr #{tmpdir}")
on(host, 'pkill -9 git-daemon')
on(host, 'pkill -9 git-daemon ; sleep 1')
end

step 'clone with puppet' do
Expand All @@ -30,8 +30,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout is on the master branch" do
Expand Down
6 changes: 3 additions & 3 deletions spec/acceptance/beaker/git/clone/clone_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

teardown do
on(host, "rm -fr #{tmpdir}")
on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1")
end

step 'clone with puppet' do
Expand All @@ -38,8 +38,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout is on the master branch" do
Expand Down
6 changes: 3 additions & 3 deletions spec/acceptance/beaker/git/clone/clone_https.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

teardown do
on(host, "rm -fr #{tmpdir}")
on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1")
end

step 'clone with puppet' do
Expand All @@ -45,8 +45,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout is on the master branch" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step 'verify new repo has replaced old one' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step 'verify exludes are known to git' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step 'verify exludes are known to git' do
Expand Down
11 changes: 6 additions & 5 deletions spec/acceptance/beaker/git/clone/clone_scp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
end
step 'setup - establish ssh keys' do
# create ssh keys
on(host, 'ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')
on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""')

# copy public key to authorized_keys
on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys')
on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config')
on(host, 'chown -R root:root /root/.ssh')
end

teardown do
on(host, "rm -fr #{tmpdir}")
apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }")
apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }")
apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", :catch_failures => true)
apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", :catch_failures => true)
end

step 'clone with puppet' do
Expand All @@ -35,8 +36,8 @@
}
EOS

apply_manifest_on(host, pp)
apply_manifest_on(host, pp)
apply_manifest_on(host, pp, :catch_failures => true)
apply_manifest_on(host, pp, :catch_changes => true)
end

step "verify checkout is on the master branch" do
Expand Down
Loading