Skip to content

Instantly share code, notes, and snippets.

@chriseckhardt
Created August 18, 2014 23:24
Show Gist options
  • Save chriseckhardt/2f416e9ff97f2d21a6d2 to your computer and use it in GitHub Desktop.
Save chriseckhardt/2f416e9ff97f2d21a6d2 to your computer and use it in GitHub Desktop.
# Puppet definition:
exec {"Clone a copy of ${scm_uri}":
command => "git clone ${scm_uri} ${source_checkout_dir}",
path => ['/usr/local/bin'],
cwd => $::nexus::nexus_root,
user => $::nexus::nexus_user,
creates => $source_checkout_dir,
require => Package['git'],
unless => "/usr/bin/test -e ${source_checkout_dir}/.git",
}
# Puppet debug output:
debug: Exec[Clone a copy of https://github.com/sonatype/nexus-ruby-support.git](provider=posix): Executing check '/usr/bin/test -e /app/nexus/nexus-ruby-support/.git'
debug: Executing '/usr/bin/test -e /app/nexus/nexus-ruby-support/.git'
debug: Exec[Clone a copy of https://github.com/sonatype/nexus-ruby-support.git](provider=posix): Executing 'git clone https://github.com/sonatype/nexus-ruby-support.git /app/nexus/nexus-ruby-support'
debug: Executing 'git clone https://github.com/sonatype/nexus-ruby-support.git /app/nexus/nexus-ruby-support'
err: /Stage[main]/Profile::Nexus/Profile::Nexus::Nexus::Plugin[ruby]/Exec[Clone a copy of https://github.com/sonatype/nexus-ruby-support.git]/returns: change from notrun to 0 failed: git clone https://github.com/sonatype/nexus-ruby-support.git /app/nexus/nexus-ruby-support returned 128 instead of one of [0] at /home/vagrant/Development/nexus-puppet/manifests/site.pp:99
# Testing the same exact command in bash as the defined user:
$ sudo -iu nexus git clone https://github.com/sonatype/nexus-ruby-support.git /app/nexus/nexus-ruby-support
Cloning into '/app/nexus/nexus-ruby-support'...
remote: Counting objects: 10584, done.
remote: Compressing objects: 100% (4220/4220), done.
remote: Total 10584 (delta 3831), reused 10584 (delta 3831)
Receiving objects: 100% (10584/10584), 5.25 MiB | 155.00 KiB/s, done.
Resolving deltas: 100% (3831/3831), done.
Checking connectivity... done
$ echo $?
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment