�
�Udac @` s| d d l m Z m Z m Z e Z d d l Z d d l m Z d d l m
Z
d Z d � Z d � Z
d
� Z d � Z d S(
i ( t absolute_importt divisiont print_functionN( t distro( t get_all_subclassest get_distributiont get_distribution_versiont get_platform_subclassc C` sj d } t j � d k rf t j � j � } | d k r? d } qf | d k rT d } qf | sf d } qf n | S( s�
Return the name of the distribution the module is running on
:rtype: NativeString or None
:returns: Name of the distribution the module is running on
This function attempts to determine what Linux distribution the code is running on and return
a string representing that value. If the distribution cannot be determined, it returns
``OtherLinux``. If not run on Linux it returns None.
t Linuxt Amznt Amazont Rhelt Redhatt
OtherLinuxN( t Nonet platformt systemR t idt
capitalize( t distribution( ( sH /usr/lib/python2.7/site-packages/ansible/module_utils/common/sys_info.pyR s c C` s� d } t d � } t j � d k r� t j � } t j � } | d k r� | | k r� t j d t � } | d k r� d j | j d � d � } n | d k r� | } q� q� q� d } n | S(
s1
Get the version of the Linux distribution the code is running on
:rtype: NativeString or None
:returns: A string representation of the version of the distribution. If it cannot determine
the version, it returns empty string. If this is not run on a Linux machine it returns None
u centosu debianR t bestu .i u N( u centosu debian(
R t frozensetR R R t versionR t Truet joint split( R t needs_best_versiont distro_idt version_best( ( sH /usr/lib/python2.7/site-packages/ansible/module_utils/common/sys_info.pyR + s c C` s� d } t j � d k r� t j � } | j d � } | d k rQ | j d � } n | d k r� t j � d k r� t j � } | j d � } n | d k r� t j � } | d k r� d } q� q� n | S( s�
Return the code name for this Linux Distribution
:rtype: NativeString or None
:returns: A string representation of the distribution's codename or None if not a Linux distro
R t version_codenamet ubuntu_codenamet ubuntut codenameu N( R R R R t os_release_infot getR t lsb_release_infoR ( R R! R# ( ( sH /usr/lib/python2.7/site-packages/ansible/module_utils/common/sys_info.pyt get_distribution_codenameT s c C` s� t j � } t � } d } | d k rw xM t | � D]<