%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/runners/ |
Current File : //usr/lib/python2.7/site-packages/salt/runners/vistara.pyo |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z e j e � Z d � Z d � Z e d � Z d � Z d � Z d � Z d S( u Vistara Runner Runner to interact with the Vistara (http://www.vistarait.com/) REST API :codeauthor: Brad Thurber <brad.thurber@gmail.com> To use this runner, the Vistara client_id and Vistara oauth2 client_key and client_secret must be set in the master config. For example ``/etc/salt/master.d/_vistara.conf``: .. code-block:: yaml vistara: client_id: client_012345 client_key: N0tReallyaR3alKeyButShouldB12345 client_secret: ThisI5AreallyLongsecretKeyIwonderwhyTheyMakethemSoBigTheseDays00 i ( t absolute_importt print_functiont unicode_literalsNc C@ s� d t k r t d n d } | r{ | j d d � } | j d d � } | j d d � } | sm | sm | rw t d f St St d f S( u@ Check to see if master config has the necessary config u vistarau client_idu client_keyu client_secretub vistara client_id or client_key or client_secret has not been specified in the Salt master config.ud vistara config has not been specificed in the Salt master config. See documentation for this runner.N( t __opts__t Nonet gett Falset True( t vistara_configt client_idt client_keyt client_secret( ( s8 /usr/lib/python2.7/site-packages/salt/runners/vistara.pyt __virtual__$ s c C@ s1 i t d d d 6t d d d 6t d d d 6S( uF Return the Vistara configuration read from the master config u vistarau client_idu client_keyu client_secret( R ( ( ( s8 /usr/lib/python2.7/site-packages/salt/runners/vistara.pyt _get_vistara_configuration8 s c C@ s� t � } | s t St | d | d � } | s4 d Sd j | � } t | | d | � } | sc d St | � } | r� | d k r� d j | � Sg } xR | D]J } | d } t j | � t | | d | � } | s� t S| j | � q� W| S( u� Deletes a device from Vistara based on DNS name or partial name. By default, delete_device will only perform the delete if a single host is returned. Set safety_on=False to delete all matches (up to default API search page size) CLI Example: .. code-block:: bash salt-run vistara.delete_device 'hostname-101.mycompany.com' salt-run vistara.delete_device 'hostname-101' salt-run vistara.delete_device 'hostname-1' safety_on=False u client_keyu client_secretu"