Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/module_utils/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/module_utils/redhat.pyo

�
�Udac@s�ddlZddlZddlZddlZddlZddlmZdefd��YZdefd��YZ	defd��YZ
d	efd
��YZdS(i����N(tconfigparsertRegistrationBasecBsYeZddd�Zd�Zd�Zd�Zd�Zd�Ze	d�Z
d�ZRS(	cCs||_||_||_dS(N(tmoduletusernametpassword(tselfRRR((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyt__init__'s		cCstd��dS(Ns"Must be implemented by a sub-class(tNotImplementedError(R((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyt	configure,scCs,d}tjj|�r(tj|�ndS(Ns/etc/yum.repos.d/redhat.repo(tostpathtisfiletunlink(Rtredhat_repo((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pytenable/scCstd��dS(Ns"Must be implemented by a sub-class(R(R((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pytregister5scCstd��dS(Ns"Must be implemented by a sub-class(R(R((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyt
unregister8scCstd��dS(Ns"Must be implemented by a sub-class(R(R((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pytunsubscribe;scCs�d|}tjj|�r�tj�\}}tj||�tj�}|j	|g�|rv|j
ddd�n|j
ddd�t|d�}|j|�|j
�|jj||�ndS(Ns/etc/yum/pluginconf.d/%s.conftmaintenablediisw+(R	R
Rttempfiletmkstemptshutiltcopy2RtConfigParsertreadtsettopentwritetcloseRtatomic_move(RtpluginRtplugin_confttmpfdttmpfiletcfgtfd((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pytupdate_plugin_conf>s


cKstd��dS(Ns"Must be implemented by a sub-class(R(Rtkwargs((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyt	subscribeQsN(t__name__t
__module__tNoneRRRRRRtTrueR%R'(((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyR&s					tRhsmcBsheZd
d
d�Zdd�Zd�Zd�Zed��Zd�Z	d�Z
d�Zd	�ZRS(cCs2tj||||�|j�|_||_dS(N(RRt_read_configtconfigR(RRRR((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyRVss/etc/rhsm/rhsm.confcCsDtj�}|j|�dd�}tj||tj�|_|S(s
            Load RHSM configuration from /etc/rhsm/rhsm.conf.
            Returns:
             * ConfigParser object
        tcSsQ|jdd�\}}|j|�rI|j||�rI|j||�S|SdS(Nt.i(tsplitthas_sectiont
has_optiontget(Rtkeytdefaulttsecttopt((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pytget_option_defaulths!(RRRttypest
MethodTypet
get_option(Rt	rhsm_conftcpR9((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyR-[s

cCs1tj|�|jdt�|jdt�dS(s�
            Enable the system to receive updates from subscription-manager.
            This involves updating affected yum plugins and removing any
            conflicting yum repositories.
        t	rhnpluginssubscription-managerN(RRR%tFalseR+(R((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyRss
cKs{ddg}xR|j�D]D\}}tjd|�r|jd|jdd�|f�qqW|jj|dt�dS(	s�
            Configure the system as directed for registration with RHN
            Raises:
              * Exception - if error occurs while running command
        ssubscription-managerR.s^(system|rhsm)_s--%s=%st_R0tcheck_rcN(titemstretsearchtappendtreplaceRtrun_commandR+(RR&targstktv((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyR}s
*cCsEddg}|jj|dt�\}}}|dkr=tStSdS(s�
            Determine whether the current system
            Returns:
              * Boolean - whether the current system is currently registered to
                          RHN.
        ssubscription-managertidentityRBiN(RRHR@R+(RRItrctstdouttstderr((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyt
is_registered�s
!c	Cs�ddg}|r&|jd|�nN|r<|jd�n|rX|jd|g�n|rt|jd|g�n|jj|dt�\}}}dS(	s�
            Register the current system to the provided RHN server
            Raises:
              * Exception - if error occurs while running command
        ssubscription-managerRs--activationkey "%s"s--autosubscribes
--usernames
--passwordRBN(RFtextendRRHR+(	RRRt
autosubscribet
activationkeyRIRMRORN((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyR�scCs4dddg}|jj|dt�\}}}dS(s�
            Unsubscribe a system from all subscribed channels
            Raises:
              * Exception - if error occurs while running command
        ssubscription-managerRs--allRBN(RRHR+(RRIRMRORN((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyR�scCsQddg}|jj|dt�\}}}|jdt�|jdt�dS(s�
            Unregister a currently registered system
            Raises:
              * Exception - if error occurs while running command
        ssubscription-managerRRBR?N(RRHR+R%R@(RRIRMRORN((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyR�s!cCs7t|j�}x!|j|�D]}|j�qWdS(s�
            Subscribe current system to available pools matching the specified
            regular expression
            Raises:
              * Exception - if error occurs while running command
        N(t	RhsmPoolsRtfilterR'(Rtregexptavailable_poolstpool((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyR'�s	N(
R(R)R*RR-RRtpropertyRPRRRR'(((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyR,Us	
					tRhsmPoolcBs)eZdZd�Zd�Zd�ZRS(sD
        Convenience class for housing subscription information
    cKs:||_x*|j�D]\}}t|||�qWdS(N(RRCtsetattr(RRR&RJRK((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyR�s	cCst|jd��S(Nt_name(tstrt__getattribute__(R((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyt__str__�scCsFd|j}|jj|dt�\}}}|dkr>tStSdS(Ns(subscription-manager subscribe --pool %sRBi(tPoolIdRRHR+R@(RRIRMRNRO((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyR'�s

!(R(R)t__doc__RR_R'(((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyRZ�s		RTcBs5eZdZd�Zd�Zd�Zdd�ZRS(sO
        This class is used for manipulating pools subscriptions with RHSM
    cCs||_|j�|_dS(N(Rt_load_product_listtproducts(RR((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyR�s	cCs
|jj�S(N(Rct__iter__(R((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyRd�sc	Csd}|jj|dt�\}}}g}x�|jd�D]�}|j�}t|�dkrgq=q=d|kr=|jdd�\}}|j�jdd�}|j�}|dkr�|jt|jd|d|��q|r|d
j	||�qq=q=W|S(sT
            Loads list of all available pools for system in data structure
        s%subscription-manager list --availableRBs
it:it R/tProductNametSubscriptionNameR\R5i����(RgRh(
RRHR+R1tstriptlenRGRFRZt__setattr__(	RRIRMRNRORctlineR5tvalue((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyRb�s !%s^$ccsAtj|�}x+|jD] }|j|j�r|VqqWdS(sc
            Return a list of RhsmPools whose name matches the provided regular expression
        N(RDtcompileRcRER\(RRVtrtproduct((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyRUs(R(R)RaRRdRbRU(((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyRT�s
			(R	RDRRR:tansible.module_utils.six.movesRtobjectRR,RZRT(((s?/usr/lib/python2.7/site-packages/ansible/module_utils/redhat.pyt<module>s/�

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]