From ca7a97c84f01a3d20103229c6c9230bf2cb1846a Mon Sep 17 00:00:00 2001 From: Kevin Reeuwijk Date: Fri, 18 Aug 2017 15:24:23 +0200 Subject: [PATCH] V104 update (#3) * 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 --- .travis.yml | 13 +++++++------ functions/build_install_args.pp | 5 +++-- functions/compare_version.pp | 2 +- functions/install_needed.pp | 15 ++++++++------- metadata.json | 4 ++-- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 173ede9..511dfe8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: - kevinr@puppet.com diff --git a/functions/build_install_args.pp b/functions/build_install_args.pp index 0acbb32..ad83758 100644 --- a/functions/build_install_args.pp +++ b/functions/build_install_args.pp @@ -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' { @@ -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 } diff --git a/functions/compare_version.pp b/functions/compare_version.pp index 91e3929..09b5005 100644 --- a/functions/compare_version.pp +++ b/functions/compare_version.pp @@ -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') diff --git a/functions/install_needed.pp b/functions/install_needed.pp index b80543f..d5b0791 100644 --- a/functions/install_needed.pp +++ b/functions/install_needed.pp @@ -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 @@ -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 } diff --git a/metadata.json b/metadata.json index 4c95ff7..93ecb81 100644 --- a/metadata.json +++ b/metadata.json @@ -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", @@ -19,7 +19,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">=4.8.0 <6.0.0" + "version_requirement": ">=4.7.0 <6.0.0" } ] }