| Server IP : 3.96.16.70 / Your IP : 216.73.216.15 Web Server : Apache System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3.9/site-packages/cfnbootstrap/__pycache__/ |
Upload File : |
a
��0iR3 � @ sn d dl mZ d dlmZ d dlmZmZ d dlZd dlZd dl Z e�
d�ZG dd� de�Z
G dd � d e�ZdS )
� )�
cmp_to_key)� ToolError)�
ProcessHelper�LoggingProcessHelperNzcfn.initc @ s2 e Zd ZdZddd�Zdd� Zdd� Zd d
� ZdS )�YumToolz$
Installs packages via Yum
Nc
C sP g }|� � st�d� |S tg d�dd��� }|jrBt�d|j� tg d�dd��� }|jrvt�d|j� t d |j��g }g }|D ]�}|| r�t
|| t�r�|| } q�t�
|| �} nd
} | r�d|| f n|}
| �|
�r�t�d|
� q�| �|
��st�d
|
� t d|
��q�| �s(|�|
� |�|� q�t�|d�d }| �| |��r\|�|
� |�|� q�t�d|
|� |�|
� |�|� q�|�s�t�d� g S |�r�t�d|� tg d�| dd�|� d��� }|j�r�t�d|j� t d|j��|�r@t�d|� tg d�| dd�|� d��� }|j�r@t�d|j� t d|j��t�d|� |S )aL
Install a set of packages via yum, returning the packages actually installed or updated.
Arguments:
action -- a dict of package name to version; version can be empty, a single string or a list of strings
Exceptions:
ToolError -- on expected failures (such as a non-zero exit code)
zNo packages specified for yum)�yum�-yZclean�metadatazyum clean metadata��namezSYum metadata clean failed. Will attempt to continue bootstapping anyway. Output: %s)r r Z makecachez
yum makecachez Yum makecache failed. Output: %szCould not create yum cacheNz%s-%sz1%s will not be installed as it is already presentz#%s is not available to be installedz/Yum does not have %s available for installationF� z+Downgrading to %s from installed version %sz'All yum packages were already installedzInstalling/updating %s via yum)r r Zinstallzyum install %s� zYum failed. Output: %sz2Could not successfully install/update yum packageszDowngrading %s via yum)r r Z downgradezyum downgrade %sz-Could not successfully downgrade yum packageszYum installed %s)�keys�log�debugr �call�
returncode�warn�stdout�errorr �
isinstance�str�RpmTool�max_version�_pkg_installed�_pkg_available�append�get_package_version�_should_upgrade�join�info)
�self�action�auth_config�pkgs_changedZclean_resultZcache_resultZpkg_specs_to_upgradeZpkg_specs_to_downgrade�pkg_nameZpkg_ver�pkg_spec�installed_version�result� r) �:/usr/lib/python3.9/site-packages/cfnbootstrap/rpm_tools.py�apply sh
""z
YumTool.applyc C sD |sdS t �||�}|dkr.t�d||� dS t�d||� dS d S )NTr zMRequested version %s is greater than installed version %s, so we will upgradezURequested version %s is NOT greater than installed version %s, so we will NOT upgradeF)r �compare_rpm_versionsr r )r! Z
requested_verr'