From 05e897e100844335b4ecaa9088d2f927753010a7 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Mon, 21 Dec 2009 22:20:34 -0800 Subject: Fix for #2881 (ralsh doesn't find individual parsed resources) Rather than just creating a new featureless resource for cases like: ralsh host localhost.localdomain (and the analogous cases with other parsed resources such as ssh keys, etc), we first check to see if the appropriate provider can find a resource with the requested name. If so, we use it; if not we fall back to the featureless form. There are a number of potential shortcomings with this fix: * It may not be particularly performant if there are many resources to be parsed. * It always (and only) checks the first provider; perhaps it should try all providers of the appropriate type. * It only checks the name property, and not any aliases or host_aliases. Signed-off-by: Markus Roberts --- lib/puppet/application/ralsh.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet') diff --git a/lib/puppet/application/ralsh.rb b/lib/puppet/application/ralsh.rb index a9921d7a7..2a0f0083d 100644 --- a/lib/puppet/application/ralsh.rb +++ b/lib/puppet/application/ralsh.rb @@ -91,7 +91,7 @@ Puppet::Application.new(:ralsh) do transbucket.sort { |a,b| a.name <=> b.name }.collect(&format) else if name - obj = typeobj.new(:name => name, :check => properties) + obj = typeobj.instances.find { |o| o.name == name } || typeobj.new(:name => name, :check => properties) vals = obj.retrieve unless params.empty? -- cgit