Skip to content
This repository has been archived by the owner on Jun 2, 2019. It is now read-only.

Speed improvements #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
9 changes: 7 additions & 2 deletions lib/puppet/provider/maven/mvn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def inlocalrepo? tempfile
end

def create(value)
debug "create #{name}"
download name, value == :latest
end

Expand Down Expand Up @@ -130,6 +131,7 @@ def download(dest, latest, offline = false)

begin
Timeout::timeout(timeout) do
debug command
output = Puppet::Util::Execution.execute(command, {:uid => user, :gid => group})

debug output if output.exitstatus == 0
Expand Down Expand Up @@ -168,11 +170,14 @@ def outdated?
download tempfile.path, true
!FileUtils.compare_file @resource[:name], tempfile.path
else
if inlocalrepo? tempfile.path
!FileUtils.compare_file @resource[:name], tempfile.path
localpath = "/root/.m2/repository/#{groupid.nil? ? '' : groupid.gsub('.', '/') + '/'}#{artifactid}/#{version}/#{artifactid}-#{version}#{classifier.nil? || classifier == '' ? '' : '-' + classifier}.#{packaging.nil? ? 'jar' : packaging}"
debug "Path to localrepo #{localpath}"
if File.exists? localpath
!FileUtils.compare_file @resource[:name], localpath
else
true
end
end
end

end
4 changes: 2 additions & 2 deletions manifests/settings.pp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
# },...]
define maven::settings( $home = undef, $user = 'root',
$servers = [], $mirrors = [], $default_repo_config = undef, $repos = [],
$properties = {}, $local_repo = '', $proxies=[]) {
$properties = {}, $local_repo = '', $proxies=[], $repo_mode = '0700') {

if $home == undef {
$home_real = $user ? {
Expand All @@ -83,7 +83,7 @@
file { "${home_real}/.m2":
ensure => directory,
owner => $user,
mode => '0700',
mode => $repo_mode,
} ->
file { "${home_real}/.m2/settings.xml":
owner => $user,
Expand Down