Skip to content

Instantly share code, notes, and snippets.

@palmertime
Last active August 29, 2015 14:04
Show Gist options
  • Save palmertime/874547e177a8cc50ea50 to your computer and use it in GitHub Desktop.
Save palmertime/874547e177a8cc50ea50 to your computer and use it in GitHub Desktop.
pe_upgrade module
# Class: pe_upgrade
#
# This module manages pe_upgrade
#
# Parameters: none
#
# Actions:
#
# Requires: see Modulefile
#
# Sample Usage:
#
class pe_upgrade (
$exec_command = $pe_upgrade::params::exec_command,
$exec_path = $pe_upgrade::params::exec_path,
$server_version = $pe_upgrade::params::master_version,
$client_version = $pe_upgrade::params::client_version,
) inherits pe_upgrade::params {
if versioncmp('$::server_version', '$::client_version') > 0 {
exec { 'wget_upgrade':
command => $exec_command,
path => $exec_path,
}
}
}
require 'spec_helper'
describe 'pe_upgrade' do
let(:facts) { { :operatingsystem => 'Solaris', :puppetversion => '3.4.2 (Puppet Enterprise 3.2.3)' } }
let(:params) { { :server_version => '3.6.2 (Puppet Enterprise 3.3.0)' } }
it { should contain_exec('wget_upgrade').with_command("wget -qO- --no-check-certificate https://puppet:8140/packages/current/install.bash | bash").with_path("/usr/sfw/bin/") }
end
describe 'pe_upgrade' do
let(:facts) { { :operatingsystem => 'Solaris', :puppetversion => '3.6.2 (Puppet Enterprise 3.3.0)'} }
it { should_not contain_exec('wget_upgrade').with_command("wget -qO- --no-check-certificate https://puppet:8140/packages/current/install.bash | bash").with_path("/usr/sfw/bin/") }
end
# Class: pe_upgrade::params
#
# This module defines the params for pe_upgrade
#
# Parameters:
#
# Actions:
#
# Requires: see Modulefile
#
# Sample Usage:
#
class pe_upgrade::params {
$exec_command = 'wget -qO- --no-check-certificate https://puppet:8140/packages/current/install.bash | bash'
case $::operatingsystem {
Redhat: {
$exec_path = '/usr/bin/'
}
Solaris: {
$exec_path = '/usr/sfw/bin/'
}
default: {
fail("Module pe_upgrade is not supported on ${::operatingsystem}")
}
}
$client_version = $::puppetversion
$server_version = $::puppetversion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment