ncorrare / windowstime

A module to manage Windows Time configuration using NTP
1 stars 5 forks source link

tzutil complains about wrong number of arguments #7

Open hboetes opened 5 years ago

hboetes commented 5 years ago

Hi there, I got this error:

Notice: /Stage[main]/Windowstime/Exec[C:\Windows\system32\tzutil.exe /s 'Central European Standard Time']/returns: TZUTIL: Ungültige Anzahl von Argumenten für "/s".
Notice: /Stage[main]/Windowstime/Exec[C:\Windows\system32\tzutil.exe /s 'Central European Standard Time']/returns: Zeigen Sie mithilfe von "TZUTIL /?" eine Liste mit gültigen Optionen an.

Which is German for wrong number of arguments. There is an easy fix:

diff --git a/manifests/init.pp b/manifests/init.pp
index 44012ed..89de205 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -88,7 +88,7 @@ class windowstime (
     validate_re($timezone, $timezones, 'The specified string is not a valid Timezone')
     if $timezone != $facts['timezone'] {
       $system32dir = $facts['os']['windows']['system32']
-      exec { "${system32dir}\\tzutil.exe /s ${timezone}":
+      exec { "${system32dir}\\tzutil.exe /s \"${timezone}\"":
       }
     }
   }

Sorry, I'm too busy for a pull request.