Skip to content

Commit

Permalink
V104 update (#3)
Browse files Browse the repository at this point in the history
* Updated build_install_args.pp to work with PE 4.7
* Update compare_version.pp to work with PE 4.7
* Update install_needed.pp to work with PE 4.7
* Update metadata.json
  • Loading branch information
Kevin Reeuwijk authored Aug 18, 2017
1 parent 551b90e commit ca7a97c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
---
language: ruby
sudo: false
branches:
only:
- master
script: puppet parser validate .
matrix:
fast_finish: true
include:
- rvm: 2.4.0
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.7.0"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 4.8.0"
- rvm: 2.4.0
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 4.9.0"
- rvm: 2.4.0
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 4.10.0"
- rvm: 2.4.0
env: PUPPET_GEM_VERSION="~> 5.0"
notifications:
email:
- [email protected]
5 changes: 3 additions & 2 deletions functions/build_install_args.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function vmtools_win::build_install_args($logfile_location, $prevent_reboot, $components_to_install, $components_to_remove) >> Array {
function vmtools_win::build_install_args($logfile_location, $prevent_reboot, $components_to_install, $components_to_remove) {
$install_options_base = ['/S', '/v"/qn']

if $logfile_location == 'None' {
Expand Down Expand Up @@ -27,5 +27,6 @@ function vmtools_win::build_install_args($logfile_location, $prevent_reboot, $co
}

$install_options_extra = split("${install_options_log1} ${install_options_log2} ${install_options_reboot} ${install_options_add} ${install_options_remove}", '\s+')
return concat($install_options_base, $install_options_extra)
$install_options = Array.assert_type(concat($install_options_base, $install_options_extra))
$install_options
}
2 changes: 1 addition & 1 deletion functions/compare_version.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function vmtools_win::compare_version(String $givenversion, String $desiredversion) >> Hash {
function vmtools_win::compare_version(String $givenversion, String $desiredversion) {
#This function compares two provided version numbers (dot-seperated) and returns the lowest level at which they differ and in which direction
#Example:
# vmtools_win::compare_version('10.1.5.5051234', '10.1.7.5541682')
Expand Down
15 changes: 8 additions & 7 deletions functions/install_needed.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function vmtools_win::install_needed($download_from_vmware, $minimum_version_level, $selfprovided_install_version) >> Boolean {
function vmtools_win::install_needed($download_from_vmware, $minimum_version_level, $selfprovided_install_version) {
#This function returns true if there are either older or no VMware Tools installed.
#This function also does some sanity checking on needed parameters and will fail compilation if they aren't provided

Expand All @@ -24,30 +24,31 @@ function vmtools_win::install_needed($download_from_vmware, $minimum_version_lev
#Now let's check if we need to upgrade, based on the returned $comparison hash
if has_key($comparison, 'Equal') {
info ('Installed version is desired version -> no upgrade needed')
return false
$install_needed = false
}
elsif has_key($comparison, 'Lower') {
info ('Installed version is lower version, checking if its below or above the minimum_version_level...')
if $comparison['Lower'] <= $minimum_version_level {
notify {'Installed version is lower version at or below the vmtools_win::minimum_version_level -> upgrade needed':}
return true
$install_needed = true
}
if $comparison['Lower'] > $minimum_version_level {
info ('Installed version is lower version but not at the vmtools_win::minimum_version_level -> no upgrade needed')
return false
$install_needed = false
}
}
elsif has_key($comparison, 'Higher') {
info ('Installed version is higher version -> no upgrade needed')
return false
$install_needed = false
}
else {
info ('Unable to determine version comparison, skipping installation')
return false
$install_needed = false
}
}
else {
notify {'There are currently no VMware Tools installed -> install needed':}
return true
$install_needed = true
}
$install_needed
}
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kreeuwijk-vmtools_win",
"version": "1.0.3",
"version": "1.0.4",
"author": "kreeuwijk",
"summary": "Install VMware Tools for Windows on VMware guests.",
"license": "Apache-2.0",
Expand All @@ -19,7 +19,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">=4.8.0 <6.0.0"
"version_requirement": ">=4.7.0 <6.0.0"
}
]
}

0 comments on commit ca7a97c

Please sign in to comment.