%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/pillar/ |
Current File : //lib/python2.7/site-packages/salt/pillar/neutron.pyo |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z y d d l j j j Z e Z Wn e k rh Z e Z n Xe j e � Z d � Z d d � Z d � Z d S( u� 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 i ( t absolute_importt print_functiont unicode_literalsNc C@ s t S( u: Only return if python-neutronclient is installed ( t HAS_NEUTRON( ( ( s7 /usr/lib/python2.7/site-packages/salt/pillar/neutron.pyt __virtual__= s c C@ sm t d | � } i | d d 6| d d 6| d d 6| d d 6| j d d � d 6| d d 6} t j | � S( u$ Set up neutron credentials u config.optionu keystone.useru usernameu keystone.passwordu passwordu keystone.tenantu tenant_nameu keystone.auth_urlu auth_urlu keystone.region_nameu region_nameu keystone.service_typeu service_typeN( t __salt__t gett Nonet suoneut SaltNeutron( t profilet credentialst kwargs( ( s7 /usr/lib/python2.7/site-packages/salt/pillar/neutron.pyt _authD s c C@ s� | j � } d } | d r) | d } n t | � } i } | j � } x | d D] } | | | d <qR Wt | � d k r� | j d � n i | | d 6S( u$ Check neutron for all data i u networksu namei i N( t splitR R t list_networkst lent append( t minion_idt pillart conft compsR t connt rett networkst network( ( s7 /usr/lib/python2.7/site-packages/salt/pillar/neutron.pyt ext_pillarU s ( t __doc__t __future__R R R t loggingt salt.utils.openstack.neutront utilst openstackt neutronR t TrueR t NameErrort exct Falset getLoggert __name__t logR R R R ( ( ( s7 /usr/lib/python2.7/site-packages/salt/pillar/neutron.pyt <module>, s