summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/provider.rb2
-rw-r--r--lib/puppet/reports/store.rb4
-rw-r--r--lib/puppet/resource/reference.rb11
-rw-r--r--lib/puppet/type.rb23
-rw-r--r--lib/puppet/type/file.rb2
5 files changed, 21 insertions, 21 deletions
diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb
index c02e15029..ce195c086 100644
--- a/lib/puppet/provider.rb
+++ b/lib/puppet/provider.rb
@@ -260,7 +260,7 @@ class Puppet::Provider
# use the hash here for later events.
@property_hash = resource
elsif resource
- @resource = resource if resource
+ @resource = resource
# LAK 2007-05-09: Keep the model stuff around for backward compatibility
@model = resource
@property_hash = {}
diff --git a/lib/puppet/reports/store.rb b/lib/puppet/reports/store.rb
index dfc992820..0c7f8cea9 100644
--- a/lib/puppet/reports/store.rb
+++ b/lib/puppet/reports/store.rb
@@ -12,7 +12,7 @@ Puppet::Reports.register_report(:store) do
def mkclientdir(client, dir)
config = Puppet::Util::Settings.new
- config.setdefaults("reportclient-#{client}",
+ config.setdefaults("reportclient-#{client}".to_sym,
"client-#{client}-dir" => { :default => dir,
:mode => 0750,
:desc => "Client dir for %s" % client,
@@ -21,7 +21,7 @@ Puppet::Reports.register_report(:store) do
}
)
- config.use("reportclient-#{client}")
+ config.use("reportclient-#{client}".to_sym)
end
def process
diff --git a/lib/puppet/resource/reference.rb b/lib/puppet/resource/reference.rb
index 7f33160bd..750c10e41 100644
--- a/lib/puppet/resource/reference.rb
+++ b/lib/puppet/resource/reference.rb
@@ -23,9 +23,14 @@ class Puppet::Resource::Reference
def initialize(argtype, argtitle = nil)
if argtitle.nil?
- self.title = argtype
- if self.title == argtype
- raise ArgumentError, "No title provided and title '%s' is not a valid resource reference" % argtype
+ if argtype.is_a?(Puppet::Type)
+ self.title = argtype.title
+ self.type = argtype.class.name
+ else
+ self.title = argtype
+ if self.title == argtype
+ raise ArgumentError, "No title provided and title '%s' is not a valid resource reference" % argtype.inspect
+ end
end
else
# This will set @type if it looks like a resource reference.
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 4bf28d97b..f8aa701f0 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -1722,20 +1722,6 @@ class Type
end
end.flatten.reject { |r| r.nil? }
end
-
- # Does this resource have a relationship with the other? We have to
- # check each object for both directions of relationship.
- def requires?(other)
- them = [other.class.name, other.title]
- me = [self.class.name, self.title]
- self.class.relationship_params.each do |param|
- case param.direction
- when :in: return true if v = self[param.name] and v.include?(them)
- when :out: return true if v = other[param.name] and v.include?(me)
- end
- end
- return false
- end
###############################
# All of the scheduling code.
@@ -1943,6 +1929,8 @@ class Type
@original_parameters = resource.to_hash
+ set_name(@original_parameters)
+
set_default(:provider)
set_parameters(@original_parameters)
@@ -1952,6 +1940,13 @@ class Type
private
+ # Set our resource's name.
+ def set_name(hash)
+ n = self.class.namevar
+ self[n] = hash[n]
+ hash.delete(n)
+ end
+
# Set all of the parameters from a hash, in the appropriate order.
def set_parameters(hash)
# Use the order provided by allattrs, but add in any
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index 91458934e..3d721ac69 100644
--- a/lib/puppet/type/file.rb
+++ b/lib/puppet/type/file.rb
@@ -28,7 +28,7 @@ module Puppet
validate do |value|
unless value =~ /^#{File::SEPARATOR}/
- raise Puppet::Error, "File paths must be fully qualified"
+ raise Puppet::Error, "File paths must be fully qualified, not '%s'" % value
end
end
end