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 <[email protected]>
---
 lib/puppet/application/ralsh.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/puppet/application/ralsh.rb b/lib/puppet/application/ralsh.rb
index a9921d7..2a0f008 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?
-- 
1.6.4

--

You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.


Reply via email to