Add Debian based distro support.
This change separates the package resource into an implementation class following the composite class pattern. In addition, the _real variables have been removed to prevent confusion. The validation functions have been updated to support a more clear regular expression. The debian package names are different, so conditional logic is required to set a debian based distro specific variable for the Java distribution name. While the puppet resources work, there is currently an issue on Lucid where the package REQUIRES interactive installation to accept the license agreement. This will need to be fixed for fully automated deployment on apt based systems.
This commit is contained in:
@@ -16,18 +16,44 @@ class java(
|
||||
$version = 'installed'
|
||||
) {
|
||||
|
||||
# Cannot pass anonymous arrays to functions in 2.6.8
|
||||
$v_distribution = [ '^jre$', '^jdk$' ]
|
||||
# Must compare string values, not booleans.
|
||||
validate_re($version, '^[._0-9a-zA-Z:-]+$')
|
||||
validate_re($distribution, $v_distribution)
|
||||
validate_re($distribution, '^jdk$|^jre$')
|
||||
validate_re($version, 'installed|^[._0-9a-zA-Z:-]+$')
|
||||
|
||||
$version_real = $version
|
||||
$distribution_real = $distribution
|
||||
anchor { 'java::begin': }
|
||||
anchor { 'java::end': }
|
||||
|
||||
case $operatingsystem {
|
||||
|
||||
centos, redhat, oel: {
|
||||
|
||||
class { 'java::package_redhat':
|
||||
version => $version,
|
||||
distribution => $distribution,
|
||||
require => Anchor['java::begin'],
|
||||
before => Anchor['java::end'],
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
debian, ubuntu: {
|
||||
|
||||
$distribution_debian = $distribution ? {
|
||||
jdk => 'sun-java6-jdk',
|
||||
jre => 'sun-java6-jre',
|
||||
}
|
||||
class { 'java::package_debian':
|
||||
version => $version,
|
||||
distribution => $distribution_debian,
|
||||
require => Anchor['java::begin'],
|
||||
before => Anchor['java::end'],
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
default: {
|
||||
fail("operatingsystem $operatingsystem is not supported")
|
||||
}
|
||||
|
||||
package { 'java':
|
||||
ensure => $version_real,
|
||||
name => "${distribution_real}",
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
28
manifests/package_debian.pp
Normal file
28
manifests/package_debian.pp
Normal file
@@ -0,0 +1,28 @@
|
||||
# Class: java::package_debian
|
||||
#
|
||||
# Implementation class of the Java package
|
||||
# for debian based systems.
|
||||
#
|
||||
# This class is not meant to be used by the end user
|
||||
# of the module. It is an implementation class
|
||||
# of the composite Class[java]
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
class java::package_debian(
|
||||
$version,
|
||||
$distribution
|
||||
) {
|
||||
|
||||
package { 'java':
|
||||
ensure => $version,
|
||||
name => $distribution,
|
||||
}
|
||||
|
||||
}
|
||||
28
manifests/package_redhat.pp
Normal file
28
manifests/package_redhat.pp
Normal file
@@ -0,0 +1,28 @@
|
||||
# Class: java::package_redhat
|
||||
#
|
||||
# Implementation class of the Java package
|
||||
# for redhat based systems.
|
||||
#
|
||||
# This class is not meant to be used by the end user
|
||||
# of the module. It is an implementation class
|
||||
# of the composite Class[java]
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
class java::package_redhat(
|
||||
$version,
|
||||
$distribution
|
||||
) {
|
||||
|
||||
package { 'java':
|
||||
ensure => $version,
|
||||
name => $distribution,
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user