+
    i  c                   s^    ^ RI HtHt ^ RIt^ RIHt ^ RIHtHt ^ RI	H
t
  ! R R]]4      tR# )i    )NoOptionErrorNoSectionErrorN)remove)PluginRedHatPlugin)sos_parse_versionc                   sP   a  ] tR t^t o RtRtR
tRtRtRt	R t
R tR tR tRtV tR	# )SubscriptionManagerz subscription-manager informationZsubscription_managerZrhsm_curl_cfgc                sv   RpVP                  RR4      pV'       d@   VP                  RR4      pVP                  RR4      pV'       d
   RV,           pRV RV V 2pVP                  RR	4      pV'       d   V'       d   VP                  RR
4      pV'       d   V P                  P                  V P                  4      V n        \        V P                  RRR7      ;_uu_ 4       pVP                  RV RV 24       RRR4       VRV P                   2,          pV# VRV 2,          pV#   + '       g   i     L6; i)z3return curl options --proxy[-user] per RHSM config  serverproxy_hostnameproxy_scheme
proxy_port:z--proxy ://
proxy_userZproxy_passwordZwzutf-8)Zencodingz--proxy-user Nz
 --config z --proxy-user )getZarchiveZ	dest_pathcurl_config_curl_cfg_fnameZopenZwrite)	selfconfigproxyr	   r
   r   r   Z
proxy_passZ_fs	   &&       L/usr/lib/python3.14/site-packages/sos/report/plugins/subscription_manager.pyget_proxy_stringZ$SubscriptionManager.get_proxy_string   s!   H.>?!::h?LHl;J :-
|nC/?
|LEZZ,7
ZH.>?J'+||'='=d>N>N'O$$..gFF"HH'
|1ZLA G :d&:&:%;<<  >*66 GFs   "D((D8	c           	     s    VP                  RR4      R8w  d   RMRpVP                  RR4      p\        V4      ^ 8  d
   RV,           pRV R	VP                  RR
4       V VP                  RR4       2# )z,return URL per RHSM config for curl command r   ZinsecureZ1Zsr   portr   Zhttpr   ZhostnameZprefix)r   Zlen)r   r   Zsecurer   s   &&  r   get_server_urlZ"SubscriptionManager.get_server_url4   sw    

8Z8C?Rzz(F+t9q=:Dvhc&**Xz"B!CD6::h124 	5    c                s   V P                  . RO4       V P                  RRR7       V P                  RRR7       V P                  . RORR7       V P                  P                  P	                  R4      pVeG   R
P                  VR,          4      p\        V4      \        R4      8  d   V P                  . RORR7       V P                  RV P                  4        24       \        P                  ! R4      pT P                  V Uu. uF  pRV 2NK
  	  upRR7       RpR	pR	V n	         ^ RI
Hp V! 4       pV P                  V4      p	V P                  V4      p
RV
 RVP                  RR4       RV	 2pVP                  RR4      pV'       d   RV/pT P                  YV^R7       R	# u upi   \        \         \"        \$        3 d   pT P'                  RT 24        R	p?LNR	p?ii ; i) 
/etc/rhsm/zsubscription-manager identityZsubscription_manager_id)Ztagsz%subscription-manager list --installedZsubscription_manager_installedT)Z
cmd_as_tagsubscription-managerNZ.Zversionz1.30.3-1zFrhsm-debug system --sos --no-archive --no-subscriptions --destination z/etc/pki/product-default/*.pemzrct cat-cert Z*subscription_manager_installed_product_idszccurl -vv --cacert /etc/rhsm/ca/redhat-uep.pem https://subscription.rhsm.redhat.com:443/subscription)get_config_parserz	curl -vv z
 --cacert ZrhsmZrepo_ca_certZ r   no_proxyZNO_PROXYz*Error checking for RHSM cert/proxy issue: )envZtimeout)r   z/var/lib/rhsm/z/var/log/rhsm/rhsm.logz/var/log/rhsm/rhsmcertd.log)z#subscription-manager release --showz#subscription-manager release --listzsyspurpose showz&subscription-manager syspurpose --showzsubscription-manager statuszsubscription-manager facts)z%subscription-manager list --availablez+subscription-manager list --all --availablez$subscription-manager list --consumed)Zadd_copy_specZadd_cmd_outputZpolicyZpackage_managerZpkg_by_nameZjoinr   Zget_cmd_output_pathglobr   Zrhsm.configr   r   r   r   ZModuleNotFoundErrorZImportErrorr    r   Z
_log_debug)r   ZsmpkgZ
sm_versionZcertsZcertZcurlcmdr   r   r   r   Z
server_urlr   Zerrs   &            r   setupZSubscriptionManager.setup>   s    + 	,
 	;!: 	 	<C!A 	 	C 
  	 	 ++778NO%	"23J ,/@/LL## % #	 $ $
 	 @#779:< 	= 		:;F}TF3F!M 	 	OJ#	P5&(F))&1E,,V4J":,j **V^<=QugGG zz(J7H!8, 	Gb9- G& $[-  	POOHNOO	Ps%   F%(A#F* F* *G#GG#c                s    R pRpV P                  RW4       RpRpV P                  RW24       V P                  '       d   \        V P                  4       RpRpV P                  RWE4       R# )	z"(proxy_password(\s)*=(\s)*)(\S+)\nz\1********\n/etc/rhsm/rhsm.confz(password(\s)*=(\s)*)(\S+)\nz/var/lib/rhsm/repo_server_val/*z(http(s)?://)\S+:\S+(@.*)z\1******:******\3z*curl*N)Zdo_path_regex_subr   r   Zdo_cmd_output_sub)r   Z	passwdregZreplZregexpZhttp_proxy_regexpZhttp_proxy_repls   &     r   postprocZSubscriptionManager.postprocx   sp    9	4iF 1@&O4''(8.x):Lr   )r   N)ZsystemZpackagemanagerZsysmgmt)r!   )r   )Z__name__Z
__module__Z__qualname__Z__firstlineno__Z
short_descZplugin_nameZprofilesZfilesZpackagesr   r   r   r    r"   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r      s?     3J(K6H$E(H!K058:tM Mr   r   )Zconfigparserr    r   r   Zosr   Zsos.report.pluginsr   r   Zsos.utilitiesr   r   ) r   r   <module>r#      s(    7   3 +}M&, }Mr   