summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-07-09 18:01:33 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-09 18:01:33 -0700
commit77f8599f55be12bf5c7d69ac8f439d1fd756eafc (patch)
treee8db2af5836d6fb4e3061531d570ffd24a087373 /lib/puppet
parent3fbc1d57f07598de225ac805ff000733480c9ff8 (diff)
downloadpuppet-77f8599f55be12bf5c7d69ac8f439d1fd756eafc.tar.gz
puppet-77f8599f55be12bf5c7d69ac8f439d1fd756eafc.tar.xz
puppet-77f8599f55be12bf5c7d69ac8f439d1fd756eafc.zip
Code smell: Win32 --> MS_windows
* Replaced 12 occurances of Win32 with Microsoft Windows 3 Examples: The code: # and all .rb files in lib/. This is disabled by default on Win32. becomes: # and all .rb files in lib/. This is disabled by default on Microsoft Windows. The code: # We can use Win32 functions becomes: # We can use Microsoft Windows functions The code: desc "Uses Win32 functionality to manage file's users and rights." becomes: desc "Uses Microsoft Windows functionality to manage file's users and rights." * Replaced 10 occurances of :win32 with :microsoft_windows 3 Examples: The code: Puppet.features.add(:win32, :libs => ["sys/admin", "win32/process", "win32/dir"]) becomes: Puppet.features.add(:microsoft_windows, :libs => ["sys/admin", "win32/process", "win32/dir"]) The code: Puppet::Type.type(:file).provide :win32 do becomes: Puppet::Type.type(:file).provide :microsoft_windows do The code: confine :feature => :win32 becomes: confine :feature => :microsoft_windows * Replaced 13 occurances of win32\? with microsoft_windows? 3 Examples: The code: signals.update({:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs }) unless Puppet.features.win32? becomes: signals.update({:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs }) unless Puppet.features.microsoft_windows? The code: raise Puppet::Error,"Cannot determine basic system flavour" unless Puppet.features.posix? or Puppet.features.win32? becomes: raise Puppet::Error,"Cannot determine basic system flavour" unless Puppet.features.posix? or Puppet.features.microsoft_windows? The code: require 'sys/admin' if Puppet.features.win32? becomes: require 'sys/admin' if Puppet.features.microsoft_windows?
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/daemon.rb2
-rw-r--r--lib/puppet/feature/base.rb6
-rw-r--r--lib/puppet/provider/file/win32.rb8
-rwxr-xr-xlib/puppet/type/exec.rb2
-rw-r--r--lib/puppet/type/file.rb2
-rw-r--r--lib/puppet/type/file/target.rb2
-rw-r--r--lib/puppet/util.rb2
-rw-r--r--lib/puppet/util/run_mode.rb4
-rw-r--r--lib/puppet/util/suidmanager.rb2
9 files changed, 15 insertions, 15 deletions
diff --git a/lib/puppet/daemon.rb b/lib/puppet/daemon.rb
index a8c0495ba..5d5c4631f 100755
--- a/lib/puppet/daemon.rb
+++ b/lib/puppet/daemon.rb
@@ -97,7 +97,7 @@ class Puppet::Daemon
def set_signal_traps
signals = {:INT => :stop, :TERM => :stop }
# extended signals not supported under windows
- signals.update({:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs }) unless Puppet.features.win32?
+ signals.update({:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs }) unless Puppet.features.microsoft_windows?
signals.each do |signal, method|
trap(signal) do
Puppet.notice "Caught #{signal}; calling #{method}"
diff --git a/lib/puppet/feature/base.rb b/lib/puppet/feature/base.rb
index a72ebb0eb..f11fb00d0 100644
--- a/lib/puppet/feature/base.rb
+++ b/lib/puppet/feature/base.rb
@@ -41,10 +41,10 @@ Puppet.features.add(:posix) do
Etc.getpwuid(0) != nil && Puppet.features.syslog?
end
-# We can use Win32 functions
-Puppet.features.add(:win32, :libs => ["sys/admin", "win32/process", "win32/dir"])
+# We can use Microsoft Windows functions
+Puppet.features.add(:microsoft_windows, :libs => ["sys/admin", "win32/process", "win32/dir"])
-raise Puppet::Error,"Cannot determine basic system flavour" unless Puppet.features.posix? or Puppet.features.win32?
+raise Puppet::Error,"Cannot determine basic system flavour" unless Puppet.features.posix? or Puppet.features.microsoft_windows?
# We have CouchDB
Puppet.features.add(:couchdb, :libs => ["couchrest"])
diff --git a/lib/puppet/provider/file/win32.rb b/lib/puppet/provider/file/win32.rb
index b19bd0c5a..21cc2deff 100644
--- a/lib/puppet/provider/file/win32.rb
+++ b/lib/puppet/provider/file/win32.rb
@@ -1,11 +1,11 @@
-Puppet::Type.type(:file).provide :win32 do
- desc "Uses Win32 functionality to manage file's users and rights."
+Puppet::Type.type(:file).provide :microsoft_windows do
+ desc "Uses Microsoft Windows functionality to manage file's users and rights."
- confine :feature => :win32
+ confine :feature => :microsoft_windows
include Puppet::Util::Warnings
- require 'sys/admin' if Puppet.features.win32?
+ require 'sys/admin' if Puppet.features.microsoft_windows?
def id2name(id)
return id.to_s if id.is_a?(Symbol)
diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb
index 0cb345af1..065f1b65d 100755
--- a/lib/puppet/type/exec.rb
+++ b/lib/puppet/type/exec.rb
@@ -575,7 +575,7 @@ module Puppet
exe = path
end
end
- elsif Puppet.features.win32? and !File.exists?(exe)
+ elsif Puppet.features.microsoft_windows? and !File.exists?(exe)
self[:path].each do |path|
[".exe", ".ps1", ".bat", ".com", ""].each do |extension|
file = File.join(path, exe+extension)
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index 37820b30f..1995c40fa 100644
--- a/lib/puppet/type/file.rb
+++ b/lib/puppet/type/file.rb
@@ -34,7 +34,7 @@ Puppet::Type.newtype(:file) do
validate do |value|
# accept various path syntaxes: lone slash, posix, win32, unc
- unless (Puppet.features.posix? and (value =~ /^\/$/ or value =~ /^\/[^\/]/)) or (Puppet.features.win32? and (value =~ /^.:\// or value =~ /^\/\/[^\/]+\/[^\/]+/))
+ unless (Puppet.features.posix? and (value =~ /^\/$/ or value =~ /^\/[^\/]/)) or (Puppet.features.microsoft_windows? and (value =~ /^.:\// or value =~ /^\/\/[^\/]+\/[^\/]+/))
fail Puppet::Error, "File paths must be fully qualified, not '#{value}'"
end
end
diff --git a/lib/puppet/type/file/target.rb b/lib/puppet/type/file/target.rb
index 6987328b6..e4a188c85 100644
--- a/lib/puppet/type/file/target.rb
+++ b/lib/puppet/type/file/target.rb
@@ -23,7 +23,7 @@ module Puppet
# Create our link.
def mklink
- raise Puppet::Error, "Cannot symlink on Win32" if Puppet.features.win32?
+ raise Puppet::Error, "Cannot symlink on Microsoft Windows" if Puppet.features.microsoft_windows?
target = self.should
diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb
index 3dd84f9a5..f9786fbe0 100644
--- a/lib/puppet/util.rb
+++ b/lib/puppet/util.rb
@@ -315,7 +315,7 @@ module Util
exit!(1)
end # begin; rescue
end # if child_pid
- elsif Puppet.features.win32?
+ elsif Puppet.features.microsoft_windows?
command = command.collect {|part| '"' + part.gsub(/"/, '\\"') + '"'}.join(" ") if command.is_a?(Array)
Puppet.debug "Creating process '%s'" % command
processinfo = Process.create(
diff --git a/lib/puppet/util/run_mode.rb b/lib/puppet/util/run_mode.rb
index fe9e07c85..bf745743f 100644
--- a/lib/puppet/util/run_mode.rb
+++ b/lib/puppet/util/run_mode.rb
@@ -27,14 +27,14 @@ module Puppet
def conf_dir
which_dir(
- (Puppet.features.win32? ? File.join(Dir::WINDOWS, "puppet", "etc") : "/etc/puppet"),
+ (Puppet.features.microsoft_windows? ? File.join(Dir::WINDOWS, "puppet", "etc") : "/etc/puppet"),
"~/.puppet"
)
end
def var_dir
which_dir(
- (Puppet.features.win32? ? File.join(Dir::WINDOWS, "puppet", "var") : "/var/lib/puppet"),
+ (Puppet.features.microsoft_windows? ? File.join(Dir::WINDOWS, "puppet", "var") : "/var/lib/puppet"),
"~/.puppet/var"
)
end
diff --git a/lib/puppet/util/suidmanager.rb b/lib/puppet/util/suidmanager.rb
index f8dbca79e..777c36411 100644
--- a/lib/puppet/util/suidmanager.rb
+++ b/lib/puppet/util/suidmanager.rb
@@ -50,7 +50,7 @@ module Puppet::Util::SUIDManager
# Runs block setting uid and gid if provided then restoring original ids
def asuser(new_uid=nil, new_gid=nil)
- return yield if Puppet.features.win32? or !root?
+ return yield if Puppet.features.microsoft_windows? or !root?
# We set both because some programs like to drop privs, i.e. bash.
old_uid, old_gid = self.uid, self.gid