diff options
author | Jacob Helwig <jacob@puppetlabs.com> | 2011-06-27 13:33:31 -0700 |
---|---|---|
committer | Jacob Helwig <jacob@puppetlabs.com> | 2011-08-19 13:48:28 -0700 |
commit | 7467a08368b09e8e36c40b5013e3774c76123b85 (patch) | |
tree | 4111fa25e47356abe33b16020557d911d7994349 /lib | |
parent | 71e190bf255f98e900f7ddd55db393d448df3274 (diff) | |
download | puppet-7467a08368b09e8e36c40b5013e3774c76123b85.tar.gz puppet-7467a08368b09e8e36c40b5013e3774c76123b85.tar.xz puppet-7467a08368b09e8e36c40b5013e3774c76123b85.zip |
(#7581) Provide more detailed error message when missing gems on Windows
Running Puppet on Windows requires the sys-admin, win32-process &
win32-dir gems. If any of these gems were missing, Puppet would fail
with the message "Cannot determine basic system flavour".
When trying to determine if we are on Windows, we now warn with the
message "Cannot run on Microsoft Windows without the sys-admin,
win32-process & win32-dir gems: #{err}", where err is the normal ruby
load error message stating which gem could not be loaded.
We also only warn if the POSIX feature is not present.
Signed-off-by: James Turnbull <james@puppetlabs.com>
Signed-off-by: Jacob Helwig <jacob@puppetlabs.com>
Reviewed-by: Cameron Thomas <cameron@puppetlabs.com>
(cherry picked from commit faf8a5c05f50d98835a1db05b96146618f485a04)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/feature/base.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/puppet/feature/base.rb b/lib/puppet/feature/base.rb index fb73df019..5f3f0023f 100644 --- a/lib/puppet/feature/base.rb +++ b/lib/puppet/feature/base.rb @@ -40,7 +40,15 @@ Puppet.features.add(:posix) do end # We can use Microsoft Windows functions -Puppet.features.add(:microsoft_windows, :libs => ["sys/admin", "win32/process", "win32/dir"]) +Puppet.features.add(:microsoft_windows) do + begin + require 'sys/admin' + require 'win32/process' + require 'win32/dir' + rescue LoadError => err + warn "Cannot run on Microsoft Windows without the sys-admin, win32-process & win32-dir gems: #{err}" unless Puppet.features.posix? + end +end raise Puppet::Error,"Cannot determine basic system flavour" unless Puppet.features.posix? or Puppet.features.microsoft_windows? |