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 <[email protected]>
Signed-off-by: Jacob Helwig <[email protected]>
Reviewed-by: Cameron Thomas <[email protected]>
---
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 c983f5c..9ed3dee 100644
--- a/lib/puppet/feature/base.rb
+++ b/lib/puppet/feature/base.rb
@@ -43,7 +43,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?
--
1.7.6
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.