File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/__pycache__/neutron.cpython-310.pyc
o
�N�g� �
@ s~ d Z ddlZzddlm m mZ dZW n ey* Z zdZW Y dZ [ ndZ [ ww e�
e�Zdd� Z
ddd�Zd d
� ZdS )a�
Use Openstack Neutron data as a Pillar source. Will list all networks listed
inside of Neutron, to all minions.
.. versionadded:: 2015.5.1
:depends: - python-neutronclient
A keystone profile must be used for the pillar to work (no generic keystone
configuration here). For example:
.. code-block:: yaml
my openstack_config:
keystone.user: 'admin'
keystone.password: 'password'
keystone.tenant: 'admin'
keystone.auth_url: 'http://127.0.0.1:5000/v2.0/'
keystone.region_name: 'RegionOne'
keystone.service_type: 'network'
After the profile is created, configure the external pillar system to use it.
.. code-block:: yaml
ext_pillar:
- neutron: my_openstack_config
Using these configuration profiles, multiple neutron sources may also be used:
.. code-block:: yaml
ext_pillar:
- neutron: my_openstack_config
- neutron: my_other_openstack_config
By default, these networks will be returned as a pillar item called
``networks``. In order to have them returned under a different name, add the
name after the Keystone profile name:
ext_pillar:
- neutron: my_openstack_config neutron_networks
� NTFc C s t S )z:
Only return if python-neutronclient is installed
)�HAS_NEUTRON� r r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/neutron.py�__virtual__: s r c C sJ t d | �}|d |d |d |d |�dd�|d d �}tjd
i |��S )z$
Set up neutron credentials
z
config.optionz
keystone.userzkeystone.passwordzkeystone.tenantzkeystone.auth_urlzkeystone.region_nameNzkeystone.service_type)�username�passwordZtenant_nameZauth_urlZregion_nameZservice_typer )Z__salt__�get�suoneuZSaltNeutron)�profileZcredentials�kwargsr r r �_authA s
� r c C sl |� � }d}|d r|d }t|�}i }|�� }|d D ]}|||d <