summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2009-12-21 22:20:34 -0800
committerJames Turnbull <james@lovedthanlost.net>2009-12-23 19:22:56 +1100
commit05e897e100844335b4ecaa9088d2f927753010a7 (patch)
treed1a4c1b095f93a5dfb244d53400f89a23af0b61b /lib/puppet
parente04f9e4823208e2d8a48ecc25fdf5152ed09ae77 (diff)
downloadpuppet-05e897e100844335b4ecaa9088d2f927753010a7.tar.gz
puppet-05e897e100844335b4ecaa9088d2f927753010a7.tar.xz
puppet-05e897e100844335b4ecaa9088d2f927753010a7.zip
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 <Markus@reality.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/application/ralsh.rb2
1 files changed, 1 insertions, 1 deletions
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?