%PDF- %PDF-
| Direktori : /proc/self/root/proc/3522530/root/lib/python2.7/site-packages/salt/runners/ |
| Current File : //proc/self/root/proc/3522530/root/lib/python2.7/site-packages/salt/runners/spacewalk.pyc |
�
���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l m Z e j e
� Z i Z d � Z
d d � Z d d � Z d � Z d
� Z d � Z d � Z d
� Z d � Z d � Z d � Z d S( u=
Spacewalk Runner
================
.. versionadded:: 2016.3.0
Runner to interact with Spacewalk using Spacewalk API
:codeauthor: Nitin Madhok <nmadhok@clemson.edu>, Joachim Werner <joe@suse.com>, Benedikt Werner <1benediktwerner@gmail.com>
:maintainer: Benedikt Werner <1benediktwerner@gmail.com>
To use this runner, set up the Spacewalk URL, username and password in the
master configuration at ``/etc/salt/master`` or ``/etc/salt/master.d/spacewalk.conf``:
.. code-block:: yaml
spacewalk:
spacewalk01.domain.com:
username: 'testuser'
password: 'verybadpass'
spacewalk02.domain.com:
username: 'testuser'
password: 'verybadpass'
.. note::
Optionally, ``protocol`` can be specified if the spacewalk server is
not using the defaults. Default is ``protocol: https``.
i ( t absolute_importt print_functiont unicode_literalsN( t sixc C@ s t � s t d f St S( uz
Check for spacewalk configuration in master config file
or directory and load runner only if it is specified
u No spacewalk configuration found( t _get_spacewalk_configurationt Falset True( ( ( s: /usr/lib/python2.7/site-packages/salt/runners/spacewalk.pyt __virtual__. s
u c C@ s$ d t k r t d n d } | r y� x� t j | � D]� \ } } | j d d � } | j d d � } | j d d � } | s� | r� t j d | � t Si d j | | � d 6| d 6| d 6} | s� | | k r5 | Sq5 WWn$ t k
r} t j d | � t SX| r t j d
| � t Sn t S( u[
Return the configuration read from the master configuration
file or directory
u spacewalku usernameu passwordu protocolu httpsuN Username or Password has not been specified in the master configuration for %su {0}://{1}/rpc/apiu api_urlu Exception encountered: %suG Configuration for %s has not been specified in the master configurationN(
t __opts__t NoneR t iteritemst gett logt errorR t formatt Exception( t
spacewalk_urlt spacewalk_configt spacewalk_servert service_configt usernamet passwordt protocolt rett exc( ( s: /usr/lib/python2.7/site-packages/salt/runners/spacewalk.pyR 8 s6
c C@ sL i } t j j j | d | d t �| d <| d j j | | � | d <| S( uA
Return the client object and session key for the client
t verboset use_datetimeu clientu key( R t movest
xmlrpc_clientt ServerR t autht login( t urlt userR R t session( ( s: /usr/lib/python2.7/site-packages/salt/runners/spacewalk.pyt _get_client_and_keyc s %c C@ s | d j j | d � d S( u#
Disconnect API connection
u clientu keyN( R t logout( R"