%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/daemons/ |
Current File : //lib/python2.7/site-packages/salt/daemons/__init__.pyo |
� ���^c @@ s% d Z d d l m Z m Z m Z d d l Z y d d l m Z m Z m Z Wn- e k r} d d l m Z m Z m Z n Xd d l m Z d d l Z d d l m Z d d l m Z e j e � Z e j d d k r� e j e j f e _ n d � Z d � Z d d e d � Z d � Z d S( us The daemons package is used to store implementations of the Salt Master and Minion enabling different transports. i ( t absolute_importt print_functiont unicode_literalsN( t Iterablet Sequencet Mapping( t namedtuple( t OrderedDict( t sixi c C@ s t | t j � o t | t � S( u� Returns True if obj is non-string iterable, False otherwise Future proof way that is compatible with both Python3 and Python2 to check for non string iterables. Assumes in Python3 that, basestring = (str, bytes) ( t isinstanceR t string_typesR ( t obj( ( s9 /usr/lib/python2.7/site-packages/salt/daemons/__init__.pyt is_non_string_iterable s c C@ s t | t j � o t | t � S( u� Returns True if obj is non-string sequence, False otherwise Future proof way that is compatible with both Python3 and Python2 to check for non string sequences. Assumes in Python3 that, basestring = (str, bytes) ( R R R R ( R ( ( s9 /usr/lib/python2.7/site-packages/salt/daemons/__init__.pyt is_non_string_sequence( s u masterc C@ s� | d k r | j | � } n | j d � } y t | � } Wn t k rV d } n X| s d } t j | � t | � � n | j | g � } | s� d j | � } t j | � | r� t | � � q� n g } t | � r�x/| D]� } t | t � r<| j d d � } | j d d � } | j t d | d | � � q� t | t j � r� | } d } | j t d | d | � � q� q� Wn� t | t � r�| j d d � } | j d d � } | j t d | d | � � n= t | t j � r| } d } | j t d | d | � � n g } xq | D]i } | d } | d } | rt | | � } | sWqn t | | � } | j t d | d | � � qqW| S( uR Parses opts and generates a list of master (host,port) addresses. By default looks for list of masters in opts['master'] and uses opts['master_port'] as the default port when otherwise not provided. To use this function to generate the cluster master list then call with masters='cluster_masters' and port='raet_port' on a master and call with masters='cluster_masters' on a minion Use the opts key given by masters for the masters list, default is 'master' If parameter port is not None then uses the default port given by port Returns a list of host address dicts of the form [ { 'external': (host,port), 'internal': (host, port) }, ... ] When only one address is provided it is assigned to the external address field When not provided the internal address field is set to None. For a given master the syntax options are as follows: hostname [port] external: hostname [port] [internal: hostaddress [port]] Where the hostname string could be either an FQDN or host address in dotted number notation. master.example.com 10.0.2.110 And the hostadress is in dotted number notation The space delimited port is optional and if not provided a default is used. The internal address is optional and if not provided is set to None Examples showing the YAML in /etc/salt/master conf file: 1) Single host name string (fqdn or dotted address) a) master: me.example.com b) master: localhost c) master: 10.0.2.205 2) Single host name string with port a) master: me.example.com 4506 b) master: 10.0.2.205 4510 3) Single master with external and optional internal host addresses for nat in a dict master: external: me.example.com 4506 internal: 10.0.2.100 4506 3) One or host host names with optional ports in a list master: - me.example.com 4506 - you.example.com 4510 - 8.8.8.8 - they.example.com 4506 - 8.8.4.4 4506 4) One or more host name with external and optional internal host addresses for Nat in a list of dicts master: - external: me.example.com 4506 internal: 10.0.2.100 4506 - external: you.example.com 4506 internal: 10.0.2.101 4506 - external: we.example.com - they.example.com u master_portu'