From 804b1302887881a92a2a6b0a7b8f32218b4aca47 Mon Sep 17 00:00:00 2001
From: Seth Vidal <skvidal@fedoraproject.org>
Date: Fri, 1 Mar 2013 18:18:56 -0500
Subject: [PATCH] check if the term is a dict so we can take a simple list of
 files (like first_available_file) takes

---
 .../runner/lookup_plugins/first_found.py      | 52 ++++++++++---------
 1 file changed, 27 insertions(+), 25 deletions(-)

diff --git a/lib/ansible/runner/lookup_plugins/first_found.py b/lib/ansible/runner/lookup_plugins/first_found.py
index c2a8fc9cfb6..09f6cc27f10 100644
--- a/lib/ansible/runner/lookup_plugins/first_found.py
+++ b/lib/ansible/runner/lookup_plugins/first_found.py
@@ -81,34 +81,36 @@ class LookupModule(object):
     def run(self, terms, **kwargs):
         result = None
         for term in terms:
-            files = term.get('files', [])
-            paths = term.get('paths', [])
-        
-            filelist = files
-            if isinstance(files, basestring):
-                files = files.replace(',', ' ')
-                files = files.replace(';', ' ')
-                filelist = files.split(' ')
+            if isinstance(term, dict):
+                files = term.get('files', [])
+                paths = term.get('paths', [])
+            
+                filelist = files
+                if isinstance(files, basestring):
+                    files = files.replace(',', ' ')
+                    files = files.replace(';', ' ')
+                    filelist = files.split(' ')
 
-            pathlist = paths
-            if paths:
-                if isinstance(paths, basestring):
-                    paths = paths.replace(',', ' ')
-                    paths = paths.replace(':', ' ')
-                    paths = paths.replace(';', ' ')
-                    pathlist = paths.split(' ')
-                
-            total_search = []
-        
+                pathlist = paths
+                if paths:
+                    if isinstance(paths, basestring):
+                        paths = paths.replace(',', ' ')
+                        paths = paths.replace(':', ' ')
+                        paths = paths.replace(';', ' ')
+                        pathlist = paths.split(' ')
+                    
+                total_search = []
+            
 
-            if not pathlist:
-                total_search = filelist
+                if not pathlist:
+                    total_search = filelist
+                else:
+                    for path in pathlist:
+                        for fn in filelist:
+                            f = path + '/' + fn
+                            total_search.append(f)
             else:
-                for path in pathlist:
-                    for fn in filelist:
-                        f = path + '/' + fn
-                        total_search.append(f)
-
+                total_search = [term]
 
             result = None
             for fn in total_search: