pythonopenstackopenstack-shade

Authentication only via config file?


I am looking into the python shade module in order to automate some tasks using our OpenStack installation.

This page instructs:

Create a configuration file to store your user name, password, project_name in ~/.config/openstack/clouds.yml.

I had a close look; but I couldn't find any information how to provide credentials in a different way; for example as parameters to some objects that I could create within python code.

Long story short: is that even possible? Or does this requirement immediately force me "off shade"; and to use the OpenStack python sdk instead?


Solution

  • I am not a python expert, but after some searching how "other" openclient modules do it; maybe the following could work (example code from your link; just a bit of enhancement):

    from shade import *
    
    auth_data = {
    # URL to the Keystone API endpoint.
      'auth_url': 'url',
    # User credentials.
    'user_domain_name': ...
    }
    

    to later do this:

    cloud = openstack_cloud(cloud='your-cloud', **auth_data)