Dynamic inventory with OpenStack

34 views
Skip to first unread message

sergio gonzalez

unread,
Jul 21, 2016, 9:07:20 AM7/21/16
to Ansible Project
Hello 

I am trying to use the dynamic inventory script:

$ ./openstack.py  --host 10.2.1.111

Traceback (most recent call last):

  File "./openstack.py", line 246, in <module>

    main()

  File "./openstack.py", line 232, in main

    inventory = shade.inventory.OpenStackInventory(**inventory_args)

  File "/usr/local/lib/python2.7/dist-packages/shade/inventory.py", line 35, in __init__

    self.extra_config = config.get_extra_config(

AttributeError: 'OpenStackConfig' object has no attribute 'get_extra_config'



That line:


class OpenStackInventory(object):


    # Put this here so the capability can be detected with hasattr on the class

    extra_config = None


  

        config = os_client_config.config.OpenStackConfig(

            config_files=os_client_config.config.CONFIG_FILES + config_files)

#Line 35 

       self.extra_config = config.get_extra_config(

            config_key, config_defaults)


It is calling os_client_config.config.OpenStackConfig


This object has this method get_extra_config:


    def get_extra_config(self, key, defaults=None):

        """Fetch an arbitrary extra chunk of config, laying in defaults.


        :param string key: name of the config section to fetch

        :param dict defaults: (optional) default values to merge under the

                                         found config

        """

        if not defaults:

            defaults = {}

        return _merge_clouds(

            self._normalize_keys(defaults),

            self._normalize_keys(self.cloud_config.get(key, {})))


Any clue?


Regards


Sergio

Reply all
Reply to author
Forward
0 new messages