[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
Markus Roberts
Markus at reality.com
Wed Jul 14 10:37:12 UTC 2010
The following commit has been merged in the upstream branch:
commit 77f8599f55be12bf5c7d69ac8f439d1fd756eafc
Author: Markus Roberts <Markus at reality.com>
Date: Fri Jul 9 18:01:33 2010 -0700
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?
diff --git a/install.rb b/install.rb
index 3f48940..eb17ec3 100755
--- a/install.rb
+++ b/install.rb
@@ -22,7 +22,7 @@
# 2) Build Rdoc documentation from all files in bin/ (excluding .bat and .cmd),
# all .rb files in lib/, ./README, ./ChangeLog, and ./Install.
# 3) Build ri documentation from all files in bin/ (excluding .bat and .cmd),
-# and all .rb files in lib/. This is disabled by default on Win32.
+# and all .rb files in lib/. This is disabled by default on Microsoft Windows.
# 4) Install commands from bin/ into the Ruby bin directory. On Windows, if a
# if a corresponding batch file (.bat or .cmd) exists in the bin directory,
# it will be copied over as well. Otherwise, a batch file (always .bat) will
diff --git a/lib/puppet/daemon.rb b/lib/puppet/daemon.rb
index a8c0495..5d5c463 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 a72ebb0..f11fb00 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 b19bd0c..21cc2de 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 0cb345a..065f1b6 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 37820b3..1995c40 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 6987328..e4a188c 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 3dd84f9..f9786fb 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 fe9e07c..bf74574 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 f8dbca7..777c364 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
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 5d94f13..e38d1e2 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -51,7 +51,7 @@ Spec::Runner.configure do |config|
if Puppet.features.posix? and file !~ /^\/tmp/ and file !~ /^\/var\/folders/
puts "Not deleting tmpfile #{file} outside of /tmp or /var/folders"
next
- elsif Puppet.features.win32?
+ elsif Puppet.features.microsoft_windows?
tempdir = File.expand_path(File.join(Dir::LOCAL_APPDATA, "Temp"))
if file !~ /^#{tempdir}/
puts "Not deleting tmpfile #{file} outside of #{tempdir}"
diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb
index 7014854..327044d 100755
--- a/spec/unit/type/file_spec.rb
+++ b/spec/unit/type/file_spec.rb
@@ -156,7 +156,7 @@ describe Puppet::Type.type(:file) do
describe "on POSIX systems" do
before do
Puppet.features.stubs(:posix?).returns(true)
- Puppet.features.stubs(:win32?).returns(false)
+ Puppet.features.stubs(:microsoft_windows?).returns(false)
end
it "should autorequire its parent directory" do
@@ -196,10 +196,10 @@ describe Puppet::Type.type(:file) do
end
end
- describe "on Win32 systems" do
+ describe "on Microsoft Windows systems" do
before do
Puppet.features.stubs(:posix?).returns(false)
- Puppet.features.stubs(:win32?).returns(true)
+ Puppet.features.stubs(:microsoft_windows?).returns(true)
end
it "should refuse to work" do
@@ -208,12 +208,12 @@ describe Puppet::Type.type(:file) do
end
end
- describe "when using Win32 filenames" do
- confine "Only works on Win32" => Puppet.features.win32?
- describe "on Win32 systems" do
+ describe "when using Microsoft Windows filenames" do
+ confine "Only works on Microsoft Windows" => Puppet.features.microsoft_windows?
+ describe "on Microsoft Windows systems" do
before do
Puppet.features.stubs(:posix?).returns(false)
- Puppet.features.stubs(:win32?).returns(true)
+ Puppet.features.stubs(:microsoft_windows?).returns(true)
end
it "should autorequire its parent directory" do
@@ -261,7 +261,7 @@ describe Puppet::Type.type(:file) do
describe "on POSIX systems" do
before do
Puppet.features.stubs(:posix?).returns(true)
- Puppet.features.stubs(:win32?).returns(false)
+ Puppet.features.stubs(:microsoft_windows?).returns(false)
end
it "should refuse to work" do
@@ -271,11 +271,11 @@ describe Puppet::Type.type(:file) do
end
describe "when using UNC filenames" do
- describe "on Win32 systems" do
- confine "Only works on Win32" => Puppet.features.win32?
+ describe "on Microsoft Windows systems" do
+ confine "Only works on Microsoft Windows" => Puppet.features.microsoft_windows?
before do
Puppet.features.stubs(:posix?).returns(false)
- Puppet.features.stubs(:win32?).returns(true)
+ Puppet.features.stubs(:microsoft_windows?).returns(true)
end
it "should autorequire its parent directory" do
@@ -324,7 +324,7 @@ describe Puppet::Type.type(:file) do
describe "on POSIX systems" do
before do
Puppet.features.stubs(:posix?).returns(true)
- Puppet.features.stubs(:win32?).returns(false)
+ Puppet.features.stubs(:microsoft_windows?).returns(false)
end
it "should refuse to work" do
@@ -407,10 +407,10 @@ describe Puppet::Type.type(:file) do
# should recode tests using expectations instead of using the filesystem
end
- describe "on Win32 systems" do
+ describe "on Microsoft Windows systems" do
before do
Puppet.features.stubs(:posix?).returns(false)
- Puppet.features.stubs(:win32?).returns(true)
+ Puppet.features.stubs(:microsoft_windows?).returns(true)
end
it "should refuse to work with links"
diff --git a/spec/unit/util/settings/file_setting_spec.rb b/spec/unit/util/settings/file_setting_spec.rb
index a6b7f02..55ad2df 100755
--- a/spec/unit/util/settings/file_setting_spec.rb
+++ b/spec/unit/util/settings/file_setting_spec.rb
@@ -147,7 +147,7 @@ describe Puppet::Util::Settings::FileSetting do
end
describe "on POSIX systems" do
- confine "no /dev on Win32" => Puppet.features.posix?
+ confine "no /dev on Microsoft Windows" => Puppet.features.posix?
it "should skip files in /dev" do
@settings.stubs(:value).with(:mydir).returns "/dev/file"
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list