User versioncmp to compare strings
Use versioncmp, otherwise with puppet 4 (as on Fedora 22) you get "A String is not comparable to a non String". We also inverted the versioncmp check for the version variable, the main reason for this was to reduce complexity of the versioncmp code. Additionally, defining 0 to be the latest version didn't really make sense. So, changing it to use 'latest' means better code readability. Change-Id: Ic8b0fd2a19cbb90e1d57e3025a3d2513ebada2e2 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
3651901d10
commit
0798386517
@ -36,7 +36,7 @@ class jenkins::cgroups {
|
|||||||
# Starting with Ubuntu Quantal (12.10) cgroup-bin dropped its upstart jobs.
|
# Starting with Ubuntu Quantal (12.10) cgroup-bin dropped its upstart jobs.
|
||||||
if $::osfamily == 'Debian' {
|
if $::osfamily == 'Debian' {
|
||||||
|
|
||||||
if $::operatingsystem == 'Ubuntu' and $::operatingsystemrelease >= '12.10' {
|
if $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '12.10') >= 0 {
|
||||||
|
|
||||||
file { '/etc/init/cgconfig.conf':
|
file { '/etc/init/cgconfig.conf':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
|
@ -7,7 +7,7 @@ class jenkins::params {
|
|||||||
'RedHat': {
|
'RedHat': {
|
||||||
#yum groupinstall "Development Tools"
|
#yum groupinstall "Development Tools"
|
||||||
# common packages
|
# common packages
|
||||||
if ($::operatingsystem == 'Fedora') and ($::operatingsystemrelease >= 21) {
|
if ($::operatingsystem == 'Fedora') and (versioncmp($::operatingsystemrelease, '21') >= 0) {
|
||||||
$jdk_package = 'java-1.8.0-openjdk-devel'
|
$jdk_package = 'java-1.8.0-openjdk-devel'
|
||||||
} else {
|
} else {
|
||||||
$jdk_package = 'java-1.7.0-openjdk-devel'
|
$jdk_package = 'java-1.7.0-openjdk-devel'
|
||||||
@ -17,7 +17,7 @@ class jenkins::params {
|
|||||||
# FIXME: No Maven packages on RHEL
|
# FIXME: No Maven packages on RHEL
|
||||||
#$maven_package = 'maven'
|
#$maven_package = 'maven'
|
||||||
$cgroups_package = 'libcgroup'
|
$cgroups_package = 'libcgroup'
|
||||||
if ($::operatingsystem == 'Fedora') and ($::operatingsystemrelease >= 19) {
|
if ($::operatingsystem == 'Fedora') and (versioncmp($::operatingsystemrelease, '19') >= 0) {
|
||||||
$cgroups_tools_package = 'libcgroup-tools'
|
$cgroups_tools_package = 'libcgroup-tools'
|
||||||
$cgconfig_require = [
|
$cgconfig_require = [
|
||||||
Package['cgroups'],
|
Package['cgroups'],
|
||||||
|
@ -18,18 +18,17 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
define jenkins::plugin(
|
define jenkins::plugin(
|
||||||
$version=0,
|
$version='latest',
|
||||||
$pin=false,
|
$pin=false,
|
||||||
) {
|
) {
|
||||||
$plugin = "${name}.hpi"
|
$plugin = "${name}.hpi"
|
||||||
$plugin_dir = '/var/lib/jenkins/plugins'
|
$plugin_dir = '/var/lib/jenkins/plugins'
|
||||||
$plugin_parent_dir = '/var/lib/jenkins'
|
$plugin_parent_dir = '/var/lib/jenkins'
|
||||||
|
|
||||||
if ($version != 0) {
|
if ($version == 'latest') {
|
||||||
$base_url = "http://updates.jenkins-ci.org/download/plugins/${name}/${version}"
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$base_url = 'http://updates.jenkins-ci.org/latest'
|
$base_url = 'http://updates.jenkins-ci.org/latest'
|
||||||
|
} else {
|
||||||
|
$base_url = "http://updates.jenkins-ci.org/download/plugins/${name}/${version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defined(File[$plugin_dir])) {
|
if (!defined(File[$plugin_dir])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user