mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-31 13:29:08 -07:00
Starting to move over lookups and fixing some bugs related to that
This commit is contained in:
parent
0823fb2cd9
commit
63c2d616e7
14 changed files with 236 additions and 61 deletions
|
@ -15,30 +15,10 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#from ansible.utils import safe_eval
|
||||
#import ansible.utils as utils
|
||||
#import ansible.errors as errors
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
|
||||
def flatten(terms):
|
||||
ret = []
|
||||
for term in terms:
|
||||
if isinstance(term, list):
|
||||
ret.extend(term)
|
||||
else:
|
||||
ret.append(term)
|
||||
return ret
|
||||
|
||||
class LookupModule(object):
|
||||
|
||||
def __init__(self, basedir=None, **kwargs):
|
||||
self.basedir = basedir
|
||||
|
||||
def run(self, terms, inject=None, **kwargs):
|
||||
# FIXME: this function needs to be ported still, or something like it
|
||||
# where really the intention is just to template a bare variable
|
||||
# with the result being a list of terms
|
||||
#terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject)
|
||||
|
||||
return flatten(terms)
|
||||
class LookupModule(LookupBase):
|
||||
|
||||
def run(self, terms, **kwargs):
|
||||
return self._flatten(terms)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue