Skip to content
This repository was archived by the owner on Jun 2, 2019. It is now read-only.
Open
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
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'

group :rake do
gem 'puppet', :require => false
gem 'rspec-puppet', '>=1.0.0', :require => false
gem 'rspec-puppet', '>=1.0.0', :git => 'https://github.com/rodjek/rspec-puppet.git', :require => false
gem 'rspec-its', :require => false
gem 'rake', :require => false
gem 'puppet-lint', :require => false
Expand Down
99 changes: 46 additions & 53 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
GIT
remote: https://github.com/rodjek/rspec-puppet.git
revision: 6ac97993fa972a15851a73d55fe3d1c0a85172b5
specs:
rspec-puppet (1.0.1)
rspec

GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.2.8)
activemodel (4.0.5)
activesupport (= 4.0.5)
builder (~> 3.1.0)
activesupport (4.0.5)
i18n (~> 0.6, >= 0.6.9)
minitest (~> 4.2)
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
addressable (2.3.6)
archive-tar-minitar (0.5.2)
autoparse (0.3.3)
Expand All @@ -20,11 +18,14 @@ GEM
aws-sdk (1.42.0)
json (~> 1.4)
nokogiri (>= 1.4.4)
beaker (1.13.0)
beaker (1.20.1)
aws-sdk (= 1.42.0)
blimpy (~> 0.6)
docker-api
fission (~> 0.4)
fog (~> 1.22.1)
google-api-client (~> 0.7.1)
hocon (~> 0.0.4)
inifile (~> 2.0)
json (~> 1.8)
mime-types (~> 1.25)
Expand All @@ -33,7 +34,7 @@ GEM
nokogiri (~> 1.5.10)
rbvmomi (= 1.8.1)
unf (~> 0.1)
beaker-rspec (2.2.5)
beaker-rspec (3.0.0)
beaker (~> 1.10)
rspec
serverspec (~> 1.0)
Expand All @@ -42,15 +43,15 @@ GEM
fog
minitar
thor
builder (3.1.4)
builder (3.2.2)
diff-lcs (1.2.5)
docker-api (1.10.11)
docker-api (1.15.0)
archive-tar-minitar
excon (>= 0.28)
excon (>= 0.38.0)
json
excon (0.37.0)
excon (0.41.0)
extlib (0.9.16)
facter (2.0.2)
facter (2.3.0)
CFPropertyList (~> 2.2.6)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
Expand All @@ -62,12 +63,13 @@ GEM
fog-json
ipaddress (~> 0.5)
nokogiri (~> 1.5, >= 1.5.11)
fog-brightbox (0.0.2)
fog-core
fog-brightbox (0.6.1)
fog-core (~> 1.22)
fog-json
fog-core (1.22.0)
inflecto
fog-core (1.25.0)
builder
excon (~> 0.33)
excon (~> 0.38)
formatador (~> 0.2)
mime-types
net-scp (~> 1.1)
Expand All @@ -86,29 +88,24 @@ GEM
retriable (>= 1.4)
signet (>= 0.5.0)
uuidtools (>= 2.1.0)
her (0.7.2)
activemodel (>= 3.0.0, < 4.2)
activesupport (>= 3.0.0, < 4.2)
faraday (>= 0.8, < 1.0)
multi_json (~> 1.7)
hiera (1.3.4)
json_pure
highline (1.6.21)
i18n (0.6.9)
hocon (0.0.6)
inflecto (0.0.2)
inifile (2.0.2)
ipaddress (0.8.0)
json (1.8.1)
json_pure (1.8.1)
jwt (1.0.0)
launchy (2.4.2)
launchy (2.4.3)
addressable (~> 2.3)
librarian (0.1.2)
highline
thor (~> 0.15)
librarian-puppet (1.1.1)
librarian-puppet (1.0.1)
json
librarian (>= 0.1.2)
puppet_forge
metaclass (0.0.4)
mime-types (1.25.1)
minitar (0.5.4)
Expand All @@ -120,22 +117,22 @@ GEM
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.9.1)
netrc (0.8.0)
nokogiri (1.5.11)
puppet (3.6.2)
puppet (3.7.3)
facter (> 1.6, < 3)
hiera (~> 1.0)
json_pure
rgen (~> 0.6.5)
puppet-blacksmith (2.1.0)
nokogiri
puppet-blacksmith (3.0.3)
puppet (>= 2.7.16)
rest-client
puppet-lint (0.3.2)
puppet_forge (1.0.2)
her (~> 0.6)
puppetlabs_spec_helper (0.5.2)
puppet-lint (1.1.0)
puppet-syntax (1.3.0)
rake
puppetlabs_spec_helper (0.8.2)
mocha
puppet-lint
puppet-syntax
rake
rspec
rspec-puppet
Expand All @@ -144,43 +141,39 @@ GEM
builder
nokogiri (>= 1.4.1)
trollop
rest-client (1.6.7)
mime-types (>= 1.16)
rest-client (1.7.2)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
retriable (1.4.1)
rgen (0.6.6)
rspec (2.99.0)
rspec-core (~> 2.99.0)
rspec-expectations (~> 2.99.0)
rspec-mocks (~> 2.99.0)
rspec-core (2.99.1)
rspec-expectations (2.99.1)
rspec-core (2.99.2)
rspec-expectations (2.99.2)
diff-lcs (>= 1.1.3, < 2.0)
rspec-its (1.0.1)
rspec-core (>= 2.99.0.beta1)
rspec-expectations (>= 2.99.0.beta1)
rspec-mocks (2.99.1)
rspec-puppet (1.0.1)
rspec
serverspec (1.9.0)
rspec-mocks (2.99.2)
serverspec (1.16.0)
highline
net-ssh
rspec (~> 2.13)
rspec (~> 2.99)
rspec-its
specinfra (~> 1.18)
specinfra (~> 1.27)
signet (0.5.1)
addressable (>= 2.2.3)
faraday (>= 0.9.0.rc5)
jwt (>= 0.1.5)
multi_json (>= 1.0.0)
specinfra (1.18.2)
specinfra (1.27.5)
thor (0.19.1)
thread_safe (0.3.4)
trollop (2.0)
tzinfo (0.3.39)
unf (0.1.4)
unf_ext
unf_ext (0.0.6)
uuidtools (2.1.4)
uuidtools (2.1.5)

PLATFORMS
ruby
Expand All @@ -197,4 +190,4 @@ DEPENDENCIES
puppetlabs_spec_helper
rake
rspec-its
rspec-puppet (>= 1.0.0)
rspec-puppet (>= 1.0.0)!
1 change: 0 additions & 1 deletion Modulefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ project_page 'http://github.com/maestrodev/puppet-maven'
source 'http://github.com/maestrodev/puppet-maven'
summary 'Apache Maven module for Puppet'
description 'A Puppet module to download artifacts from Maven repositories'
dependency 'maestrodev/wget', '>=1.0.0'
1 change: 0 additions & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
forge 'http://forge.puppetlabs.com'

mod 'maestrodev/wget', '>=1.0.0'
6 changes: 0 additions & 6 deletions Puppetfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
FORGE
remote: http://forge.puppetlabs.com
specs:
maestrodev/wget (1.1.0)

DEPENDENCIES
maestrodev/wget (>= 1.0.0)

67 changes: 43 additions & 24 deletions manifests/maven.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
# - $version:
# Maven version.
#
# - $manage_symlink:
# If symlink should be managed
#
# - $system_package:
# Name of system package to install. False to install with wget / tar
#
# - $symlink_target:
# Optional alternative path to mvn cmd
#
# Requires:
# Java package installed.
#
Expand All @@ -30,48 +39,58 @@
#
class maven::maven(
$version = '3.0.5',
$manage_symlink = true,
$system_package = false,
$symlink_target = undef,
$repo = {
#url => 'http://repo1.maven.org/maven2',
#username => '',
#password => '',
} ) {

$archive = "/tmp/apache-maven-${version}-bin.tar.gz"

# Avoid redownloading when tmp tar.gz is deleted
if $::maven_version != $version {

# we could use puppet-stdlib function !empty(repo) but avoiding adding a new
# dependency for now
if $system_package {
package { $system_package:
ensure => $version
} ->
File <| title == '/usr/bin/mvn' |>
} else {
if "x${repo['url']}x" != 'xx' {
wget::authfetch { 'fetch-maven':
source => "${repo['url']}/org/apache/maven/apache-maven/$version/apache-maven-${version}-bin.tar.gz",
destination => $archive,
user => $repo['username'],
password => $repo['password'],
before => Exec['maven-untar'],
}
$repo_url = "${repo['url']}/org/apache/maven/apache-maven/${version}/apache-maven-${version}-bin.tar.gz"
} else {
wget::fetch { 'fetch-maven':
source => "http://archive.apache.org/dist/maven/binaries/apache-maven-${version}-bin.tar.gz",
destination => $archive,
before => Exec['maven-untar'],
$repo_url = "http://archive.apache.org/dist/maven/binaries/apache-maven-${version}-bin.tar.gz"
}
if !defined(Package['wget']) {
package { 'wget':
ensure => present
}
}
exec { 'maven-untar':
command => "tar xf /tmp/apache-maven-${version}-bin.tar.gz",
if "x${repo['username']}x" != 'xx' and "x${repo['password']}x" != 'xx' {
$wget_login = "--user=\"${repo['username']}\" --password=\"${repo['password']}\" "
} else {
$wget_login = ''
}
exec { 'install_maven':
command => "wget -O - ${wget_login}${repo_url} | tar zxf -",
cwd => '/opt',
path => ['/usr/local/bin', '/usr/bin', '/bin'],
creates => "/opt/apache-maven-${version}",
path => ['/bin','/usr/bin'],
}
require => Package['wget']
} ->
File <| title == '/usr/bin/mvn' |>
}

if $manage_symlink {
$symlink_target_real = $symlink_target ? {
undef => "/opt/apache-maven-${version}/bin/mvn",
default => $symlink_target
}
file { '/usr/bin/mvn':
ensure => link,
target => "/opt/apache-maven-${version}/bin/mvn",
require => Exec['maven-untar'],
target => $symlink_target_real
} ->
file { '/usr/local/bin/mvn':
ensure => absent,
}
}

}
Loading