Skip to content

Commit

Permalink
Install $majdistrelease pattern in params.pp.
Browse files Browse the repository at this point in the history
Convert all $majdistrelease to $vmwaretools::params::majdistrelease to
use the centralized fact discovery.
  • Loading branch information
razorsedge committed Jul 23, 2013
1 parent 0e3bbc4 commit b35a888
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
7 changes: 1 addition & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,7 @@
notify => Service[$service_name_real],
}

$majdistrelease = $::lsbmajdistrelease ? {
'' => regsubst($::operatingsystemrelease,'^(\d+)\.(\d+)','\1'),
default => $::lsbmajdistrelease,
}

if ($::osfamily == 'RedHat') and ($majdistrelease == '6') and ($rhel_upstart == true) {
if ($::osfamily == 'RedHat') and ($vmwaretools::params::majdistrelease == '6') and ($rhel_upstart == true) {
# VMware-tools 5.1 on EL6 is now using upstart and not System V init.
# http://projects.puppetlabs.com/issues/11989#note-7
service { $service_name_real :
Expand Down
10 changes: 10 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@
$safe_service_hasrestart = $service_hasrestart
}

if $::operatingsystemmajrelease { # facter 1.7+
$majdistrelease = $::operatingsystemmajrelease
} elsif $::lsbmajdistrelease { # requires LSB to already be installed
$majdistrelease = $::lsbmajdistrelease
} elsif $::os_maj_version { # requires stahnma/epel
$majdistrelease = $::os_maj_version
} else {
$majdistrelease = regsubst($::operatingsystemrelease,'^(\d+)\.(\d+)','\1')
}

case $::osfamily {
'RedHat': {
case $::operatingsystem {
Expand Down
9 changes: 2 additions & 7 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,16 @@
'RedHat', 'CentOS', 'Scientific', 'SLC', 'Ascendos', 'PSBM',
'OracleLinux', 'OVS', 'OEL', 'SLES', 'SLED', 'OpenSuSE',
'SuSE': {
$majdistrelease = $::lsbmajdistrelease ? {
'' => regsubst($::operatingsystemrelease,'^(\d+)\.(\d+)','\1'),
default => $::lsbmajdistrelease,
}

if ( $yum_path == $vmwaretools::params::yum_path ) or ( $just_prepend_yum_path == true ) {
$gpgkey_url = "${yum_server}${yum_path}/keys/"
$baseurl_url = "${yum_server}${yum_path}/esx/${tools_version}/${vmwaretools::params::baseurl_string}${majdistrelease}/${yum_basearch}/"
$baseurl_url = "${yum_server}${yum_path}/esx/${tools_version}/${vmwaretools::params::baseurl_string}${vmwaretools::params::majdistrelease}/${yum_basearch}/"
} else {
$gpgkey_url = "${yum_server}${yum_path}/"
$baseurl_url = "${yum_server}${yum_path}/"
}

yumrepo { 'vmware-tools':
descr => "VMware Tools ${tools_version} - ${vmwaretools::params::baseurl_string}${majdistrelease} ${yum_basearch}",
descr => "VMware Tools ${tools_version} - ${vmwaretools::params::baseurl_string}${vmwaretools::params::majdistrelease} ${yum_basearch}",
enabled => $yumrepo_enabled,
gpgcheck => '1',
# gpgkey has to be a string value with an indented second line
Expand Down

0 comments on commit b35a888

Please sign in to comment.