Skip to content

Commit

Permalink
update firewall
Browse files Browse the repository at this point in the history
  • Loading branch information
cristifalcas committed Oct 6, 2014
1 parent a1f732d commit 3d65bf2
Showing 1 changed file with 11 additions and 46 deletions.
57 changes: 11 additions & 46 deletions manifests/plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@
validate_bool($manage_config)
# TODO: validate_str($update_url)

$plugins_host = $update_url ? {
undef => $::jenkins::params::default_plugins_host,
default => $update_url,
}

if ($version != 0) {
$plugins_host = $update_url ? {
undef => $::jenkins::params::default_plugins_host,
default => $update_url,
}
$base_url = "${plugins_host}/download/plugins/${name}/${version}/"
$search = "${name} ${version}(,|$)"
}
else {
$plugins_host = $update_url ? {
undef => $::jenkins::params::default_plugins_host,
default => $update_url,
}
$base_url = "${plugins_host}/latest/"
$search = "${name} "
}
Expand Down Expand Up @@ -79,41 +82,6 @@
}
}

if ($version == 'absent' or $version == 'uninstall') {
# for bundled and updated plugins, remove everything and disable the jpi plugin
exec { "uninstall-${name}" :
command => "rm -rf ${name} ${plugin} ${name}.jpi ${name}.jpi.pinned && touch ${name}.jpi.disabled",
cwd => $plugin_dir,
onlyif => "test -f ${plugin_dir}/${plugin}",
path => ['/usr/bin', '/usr/sbin', '/bin'],
}

# for bundled plugins, disable the jpi plugin
exec { "disable-${name}.jpi" :
command => "touch ${plugin_dir}/${name}.jpi.disabled",
cwd => $plugin_dir,
require => File[$plugin_dir],
path => ['/usr/bin', '/usr/sbin', '/bin'],
onlyif => "test -f ${plugin_dir}/${name}.jpi -a ! -f ${plugin_dir}/${name}.jpi.disabled",
}
} elsif ($version == 'disable' or $version == 'disabled') {
exec { "disable-${name}.jpi" :
command => "touch ${plugin_dir}/${name}.jpi.disabled",
cwd => $plugin_dir,
require => File[$plugin_dir],
path => ['/usr/bin', '/usr/sbin', '/bin'],
onlyif => "test -f ${plugin_dir}/${name}.jpi -a ! -f ${plugin_dir}/${name}.jpi.disabled",
}

exec { "disable-${plugin}" :
command => "touch ${plugin_dir}/${plugin}.disabled",
cwd => $plugin_dir,
require => File[$plugin_dir],
path => ['/usr/bin', '/usr/sbin', '/bin'],
onlyif => "test -f ${plugin_dir}/${plugin} -a ! -f ${plugin_dir}/${plugin}.disabled",
}
} else {

if (empty(grep([ $::jenkins_plugins ], $search))) {
if ($jenkins::proxy_host) {
Exec {
Expand All @@ -135,8 +103,9 @@
before => Exec["download-${name}"],
}


exec { "download-${name}" :
command => "rm -rf ${name} ${plugin} ${name}.jpi && wget --no-check-certificate ${base_url}${plugin}",
command => "rm -rf ${name} ${name}.hpi ${name}.jpi && wget --no-check-certificate ${base_url}${plugin}",
cwd => $plugin_dir,
require => [File[$plugin_dir], Package['wget']],
path => ['/usr/bin', '/usr/sbin', '/bin'],
Expand All @@ -148,10 +117,6 @@
mode => '0644',
notify => Service['jenkins'],
}

file { ["${plugin_dir}/${name}.jpi.disabled", "${plugin_dir}/${plugin}.disabled"] :
ensure => absent,
}
}

if $manage_config {
Expand All @@ -168,5 +133,5 @@
notify => Service['jenkins']
}
}
}
}

0 comments on commit 3d65bf2

Please sign in to comment.