OS : Linux
PHP Version : 7.4.33
Software : Apache/2.4.6 (CentOS) PHP/7.4.33
Information System : Linux apprendre2 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
Disable Function : ó
oBú]c @ s† d Z d d l m Z d d l m Z e j e ƒ Z d d g Z d „ Z d e
f d „ ƒ YZ d e f d
„ ƒ YZ
e d „ Z d S(
s"
RedHat Subscription
-------------------
**Summary:** register red hat enterprise linux based system
Register a RedHat system either by username and password *or* activation and
org. Following a sucessful registration, you can auto-attach subscriptions, set
the service level, add subscriptions based on pool id, enable/disable yum
repositories based on repo id, and alter the rhsm_baseurl and server-hostname
in ``/etc/rhsm/rhs.conf``. For more details, see the ``Register RedHat
Subscription`` example config.
**Internal name:** ``cc_rh_subscription``
**Module frequency:** per instance
**Supported distros:** rhel, fedora
**Config keys**::
rh_subscription:
username:
password:
activation-key:
org:
auto-attach:
service-level:
add-pool:
enable-repo:
disable-repo:
rhsm-baseurl:
server-hostname:
iÿÿÿÿ( t log( t utilt fedorat rhelc C sñ t | d | ƒ} | j ƒ s2 | j d | ƒ d S| j ƒ sàyi| j ƒ \ } } | t k rn t | ƒ ‚ n | j ƒ } | s t d ƒ ‚ n | j rÕ | j
d k rÕ | j ƒ s t d ƒ ‚ q| j j d ƒ n7 | j r| j
ƒ sù t d ƒ ‚ q| j j d ƒ n | j d k rxt | j t ƒ sBd } t | ƒ ‚ n | j | j ƒ }
|
sxt d j | j ƒ ƒ ‚ qxn | j ƒ }
|
s™t d
ƒ ‚ n | j d ƒ Wqít k
rÜ} | j t | ƒ ƒ | j d ƒ qíXn
| j d
ƒ d S( NR s %s: module not configured.s- Registration failed or did not run completelys Setting of service-level faileds( Completed auto-attach with service levels Setting auto-attach faileds Completed auto-attachs" Pools must in the format of a lists Unable to attach pools {0}s Unable to add or remove reposs- rh_subscription plugin completed successfullys4 rh_subscription plugin did not complete successfullys System is already registered( t SubscriptionManagert
is_configuredt debugt Nonet
is_registeredt _verify_keyst Truet SubscriptionErrort rhn_registert auto_attacht servicelevelt _set_service_levelR t _set_auto_attacht poolst
isinstancet listt addPoolt formatt update_repost log_successt log_warnt str( t namet cfgt _cloudR t _argst smt verifyt
verify_msgt contt pool_failt return_statt e( ( sG /usr/lib/python2.7/site-packages/cloudinit/config/cc_rh_subscription.pyt handle1 sH R c B s e Z RS( ( t __name__t
__module__( ( ( sG /usr/lib/python2.7/site-packages/cloudinit/config/cc_rh_subscription.pyR f s R c B s§ e Z d d d d d d d d d d d
g Z d d „ Z d „ Z d
„ Z d „ Z d „ Z d „ Z d „ Z
d „ Z d „ Z d „ Z
d „ Z d „ Z d „ Z RS( t orgs activation-keyt usernamet passwords disable-repos enable-repos add-pools rhsm-baseurls server-hostnames auto-attachs
service-levelc C s* | d k r t } n | | _ | | _ | j j d i ƒ | _ | j j d ƒ | _ | j j d ƒ | _ | j j d ƒ | _ | j j d ƒ | _ | j j d ƒ | _
| j j d ƒ | _ | j j d ƒ | _ | j j d ƒ | _
| j j d
ƒ | _ | j j d ƒ | _ | j j d ƒ | _ d S(
Nt rh_subscriptions rhsm-baseurls server-hostnames add-pools activation-keyR( R) R* s auto-attachs enable-repos disable-repos
service-level( R t LOGR R t gett rhel_cfgt rhsm_baseurlt server_hostnameR t activation_keyR( t useridR* R
t enable_repot disable_repoR ( t selfR R ( ( sG /usr/lib/python2.7/site-packages/cloudinit/config/cc_rh_subscription.pyt __init__p s c C s | j j | ƒ d S( s> Simple wrapper for logging info messages. Useful for unittestsN( R t info( R5 t msg( ( sG /usr/lib/python2.7/site-packages/cloudinit/config/cc_rh_subscription.pyR ‚ s c C s | j j | ƒ d S( sA Simple wrapper for logging warning messages. Useful for unittestsN( R t warning( R5 R8 ( ( sG /usr/lib/python2.7/site-packages/cloudinit/config/cc_rh_subscription.pyR † s c C sÚ xH | j D]= } | | j k r
d j | d j | j ƒ ƒ } t | f Sq
W| j d k r t j | j ƒ p{ t j | j ƒ r d } t | f S| j
d k rÐ | j sÀ t j t | j ƒ ƒ rÐ d } t | f St d f S( sq
Checks that the keys in the rh_subscription dict from the user-data
are what we expect.
s? {0} is not a valid key for rh_subscription. Valid keys are: {1}s , s8 The key auto-attach must be a boolean value (True/False sq The service-level key must be used in conjunction with the auto-attach key. Please re-run with auto-attach: TrueN(
R. t
valid_rh_keysR t joint FalseR
R R t is_truet is_falseR R R
( R5 t kt bad_keyt not_boolt no_auto( ( sG /usr/lib/python2.7/site-packages/cloudinit/config/cc_rh_subscription.pyR Š s
c C s3 d g } y t | ƒ Wn t j k
r. t SXt S( sg
Checks if the system is already registered and returns
True if so, else False
t identity( t _sub_man_cliR t ProcessExecutionErrorR<