summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-10 21:46:59 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-10 21:46:59 +0000
commiteca5510b293ec83169aae10518c11660886286d1 (patch)
treea788e0ccfbcfc78bdde3aa31d1b60f7b10c7c90f
parent55666a515ace73680eaacc7f496fd89305c47f89 (diff)
downloadpuppet-eca5510b293ec83169aae10518c11660886286d1.tar.gz
puppet-eca5510b293ec83169aae10518c11660886286d1.tar.xz
puppet-eca5510b293ec83169aae10518c11660886286d1.zip
Fixing the to_trans method and ralsh a bit so ralsh now works with the new lack of "is" method
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2503 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xbin/ralsh20
-rw-r--r--lib/puppet/parameter.rb2
-rw-r--r--lib/puppet/type.rb8
3 files changed, 20 insertions, 10 deletions
diff --git a/bin/ralsh b/bin/ralsh
index cdb0ab345..ce7146725 100755
--- a/bin/ralsh
+++ b/bin/ralsh
@@ -113,7 +113,7 @@ result.each { |opt,arg|
end
exit
else
- raise "Invalid option '#{opt}'"
+ # Anything else is handled by the config stuff
end
}
@@ -141,7 +141,7 @@ unless typeobj = Puppet::Type.type(type)
raise "Could not find type %s" % type
end
-states = typeobj.states.collect { |s| s.name }
+properties = typeobj.properties.collect { |s| s.name }
format = proc {|trans|
trans.dup.collect do |param, value|
@@ -149,7 +149,7 @@ format = proc {|trans|
trans.delete(param)
end
- unless states.include?(param) or extra_params.include?(param)
+ unless properties.include?(param) or extra_params.include?(param)
trans.delete(param)
end
end
@@ -174,10 +174,16 @@ text = if host
end
transbucket.sort { |a,b| a.name <=> b.name }.collect(&format)
else
- typeobj.list.collect do |obj|
- next if ARGV.length > 0 and ! ARGV.include? obj.name
- trans = obj.to_trans(true)
- format.call(trans)
+ if name
+ obj = typeobj.create(:name => name, :check => properties)
+ vals = obj.retrieve
+ [format.call(obj.to_trans(true))]
+ else
+ typeobj.list.collect do |obj|
+ next if ARGV.length > 0 and ! ARGV.include? obj.name
+ trans = obj.to_trans(true)
+ format.call(trans)
+ end
end
end.compact.join("\n")
diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb
index bf50030f3..b427c1058 100644
--- a/lib/puppet/parameter.rb
+++ b/lib/puppet/parameter.rb
@@ -419,7 +419,7 @@ class Puppet::Parameter < Puppet::Element
if self.should
return self.should
else
- return self.is
+ return self.retrieve
end
else
if defined? @value
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 2b49492b2..d8e03ceca 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -353,13 +353,17 @@ class Type < Puppet::Element
trans = TransObject.new(self.title, self.class.name)
- properties().each do |property|
- trans[property.name] = property.is
+ values = retrieve()
+ values.each do |name, value|
+ trans[name.name] = value
end
@parameters.each do |name, param|
# Avoid adding each instance name as both the name and the namevar
next if param.class.isnamevar? and param.value == self.title
+
+ # We've already got property values
+ next if param.is_a?(Puppet::Property)
trans[name] = param.value
end