Migration to Ansible 2.0: problem with changed (internal) APIs: utils.load_vars missing

21 views
Skip to first unread message

Karsten

unread,
Jun 8, 2016, 10:31:32 AM6/8/16
to Ansible Project
Hi there,

i've extended our ansible inventory for ansible 1.9.1 with a custom vars-plugin. This plugin uses the method load_vars from the utils module/class imported by "from ansible import utils" (sorry for this simple description, i'm not that proficient in python).

The code using load_vars looks like this:

class VarsModule(object):
// ...
   def _collect_results(self, base_path, group_name, vault_password, results):
        path
= os.path.join(base_path, group_name)
       
if not os.path.exists(path):
           
return results

        results
=  utils.load_vars(path, results, vault_password=vault_password)
       
return results
//...

It get's a base-path, a group-name and an dictionary containing other variables an combines them with the variables from the files below the folder "base_path/group_name".

The method utils.load_vars is missing from the new 2.x APIs (yeah i know, never work against internal apis...). Is there a way to achieve its behaviour using the new API?

Kind regards

Karsten

Reply all
Reply to author
Forward
0 new messages