summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-15 19:22:36 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-15 19:22:36 +0000
commitdbedcd7b9892bc41728a4f334464f152d09d54fc (patch)
tree66e06fa8fec48ea00491a728ed24906e6b810812 /lib
parent28f7d6c7ebd56da3014464c82c73a4f98f3406ea (diff)
downloadpuppet-dbedcd7b9892bc41728a4f334464f152d09d54fc.tar.gz
puppet-dbedcd7b9892bc41728a4f334464f152d09d54fc.tar.xz
puppet-dbedcd7b9892bc41728a4f334464f152d09d54fc.zip
A round of fixes so unit tests pass; most of the failures were from the merging of the transaction-refactor branch
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2517 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/network/client/master.rb2
-rwxr-xr-xlib/puppet/network/handler/report.rb2
-rwxr-xr-xlib/puppet/type/cron.rb5
-rwxr-xr-xlib/puppet/type/host.rb2
-rwxr-xr-xlib/puppet/type/mount.rb2
-rwxr-xr-xlib/puppet/type/port.rb2
-rw-r--r--lib/puppet/type/resources.rb4
-rw-r--r--lib/puppet/type/yumrepo.rb1
-rwxr-xr-xlib/puppet/util/posix.rb7
9 files changed, 12 insertions, 15 deletions
diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb
index e7739ba34..7eb009b2d 100644
--- a/lib/puppet/network/client/master.rb
+++ b/lib/puppet/network/client/master.rb
@@ -544,7 +544,7 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
# Have the facts changed since we last compiled?
def facts_changed?(facts)
- oldfacts = Puppet::Util::Storage.cache(:configuration)[:facts].dup
+ oldfacts = (Puppet::Util::Storage.cache(:configuration)[:facts] || {}).dup
newfacts = facts.dup
self.class.dynamic_facts.each do |fact|
[oldfacts, newfacts].each do |facthash|
diff --git a/lib/puppet/network/handler/report.rb b/lib/puppet/network/handler/report.rb
index ce5176a36..827f5978b 100755
--- a/lib/puppet/network/handler/report.rb
+++ b/lib/puppet/network/handler/report.rb
@@ -65,7 +65,7 @@ class Puppet::Network::Handler
# List each of the reports.
def self.reports
instance_loader(:report).loadall
- @reports.keys
+ loaded_instances(:report)
end
def initialize(*args)
diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb
index cf4f7cc33..ff0ef8f7d 100755
--- a/lib/puppet/type/cron.rb
+++ b/lib/puppet/type/cron.rb
@@ -2,7 +2,6 @@ require 'etc'
require 'facter'
require 'puppet/type/property'
require 'puppet/util/filetype'
-require 'puppet/type/parsedtype'
Puppet::Type.newtype(:cron) do
@doc = "Installs and manages cron jobs. All fields except the command
@@ -29,9 +28,7 @@ Puppet::Type.newtype(:cron) do
ensurable
# A base class for all of the Cron parameters, since they all have
- # similar argument checking going on. We're stealing the base class
- # from parsedtype, and we should probably subclass Cron from there,
- # but it was just too annoying to do.
+ # similar argument checking going on.
class CronParam < Puppet::Property
class << self
attr_accessor :boundaries, :default
diff --git a/lib/puppet/type/host.rb b/lib/puppet/type/host.rb
index 6ff02c155..6a2e9082d 100755
--- a/lib/puppet/type/host.rb
+++ b/lib/puppet/type/host.rb
@@ -1,5 +1,3 @@
-require 'puppet/type/parsedtype'
-
module Puppet
newtype(:host) do
ensurable
diff --git a/lib/puppet/type/mount.rb b/lib/puppet/type/mount.rb
index dd70f87a6..08cc42cda 100755
--- a/lib/puppet/type/mount.rb
+++ b/lib/puppet/type/mount.rb
@@ -1,5 +1,3 @@
-require 'puppet/type/parsedtype'
-
module Puppet
# We want the mount to refresh when it changes.
newtype(:mount, :self_refresh => true) do
diff --git a/lib/puppet/type/port.rb b/lib/puppet/type/port.rb
index 19c3dae76..dc2220070 100755
--- a/lib/puppet/type/port.rb
+++ b/lib/puppet/type/port.rb
@@ -1,5 +1,3 @@
-require 'puppet/type/parsedtype'
-
#module Puppet
# newtype(:port) do
# @doc = "Installs and manages port entries. For most systems, these
diff --git a/lib/puppet/type/resources.rb b/lib/puppet/type/resources.rb
index b314c9441..ca88a7c31 100644
--- a/lib/puppet/type/resources.rb
+++ b/lib/puppet/type/resources.rb
@@ -124,6 +124,8 @@ Puppet::Type.newtype(:resources) do
@resource_type
end
+ # Make sure we don't purge users below a certain uid, if the check
+ # is enabled.
def user_check(resource)
return true unless self[:name] == "user"
return true unless self[:unless_system_user]
@@ -134,6 +136,8 @@ Puppet::Type.newtype(:resources) do
if system_users().include?(resource[:name])
return false
end
+
+ resource.info current_values.inspect
if current_values[resource.property(:uid)] <= self[:unless_system_user]
return false
diff --git a/lib/puppet/type/yumrepo.rb b/lib/puppet/type/yumrepo.rb
index a344d2c3b..ac8704434 100644
--- a/lib/puppet/type/yumrepo.rb
+++ b/lib/puppet/type/yumrepo.rb
@@ -2,7 +2,6 @@
require 'puppet/propertychange'
require 'puppet/util/inifile'
-require 'puppet/type/parsedtype'
module Puppet
# A property for one entry in a .ini-style file
diff --git a/lib/puppet/util/posix.rb b/lib/puppet/util/posix.rb
index 9131b394d..06df632a9 100755
--- a/lib/puppet/util/posix.rb
+++ b/lib/puppet/util/posix.rb
@@ -3,6 +3,9 @@ module Puppet::Util::POSIX
# Retrieve a field from a POSIX Etc object. The id can be either an integer
# or a name. This only works for users and groups.
def get_posix_field(space, field, id)
+ unless id
+ raise ArgumentError, "Did not get id"
+ end
if id =~ /^\d+$/
id = Integer(id)
end
@@ -37,7 +40,7 @@ module Puppet::Util::POSIX
obj = typeklass.find { |obj|
if id =~ /^\d+$/
obj.should(chkfield).to_s == id ||
- obj.is(chkfield).to_s == id
+ obj.provider.send(chkfield) == id
else
obj[:name] == id
end
@@ -84,4 +87,4 @@ module Puppet::Util::POSIX
end
end
-# $Id$ \ No newline at end of file
+# $Id$