403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib/python3.11/site-packages/ansible/modules/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib/python3.11/site-packages/ansible/modules/__pycache__/yum.cpython-311.opt-1.pyc
�

���c1 ���ddlmZmZmZeZdZdZddlm	Z	ddl
mZddlm
Z
mZddlmZmZddlmZdd	lmZmZdd
lZdd
lZdd
lZdd
lZdd
lZ	dd
lZdZn
#e$rdZYnwxYw	dd
lZdZ n
#e$rdZ YnwxYw	dd
l!m"Z"m#Z#ddl$m%Z%m&Z&dZ'n
#e$rdZ'YnwxYwddl(m)Z)ddlm*Z*dZ+d
a,Gd�de��Z-d�Z.e/dkre.��d
Sd
S)�)�absolute_import�division�print_functiona�.
---
module: yum
version_added: historical
short_description: Manages packages with the I(yum) package manager
description:
     - Installs, upgrade, downgrades, removes, and lists packages and groups with the I(yum) package manager.
     - This module only works on Python 2. If you require Python 3 support see the M(ansible.builtin.dnf) module.
options:
  use_backend:
    description:
      - This module supports C(yum) (as it always has), this is known as C(yum3)/C(YUM3)/C(yum-deprecated) by
        upstream yum developers. As of Ansible 2.7+, this module also supports C(YUM4), which is the
        "new yum" and it has an C(dnf) backend.
      - By default, this module will select the backend based on the C(ansible_pkg_mgr) fact.
    default: "auto"
    choices: [ auto, yum, yum4, dnf ]
    type: str
    version_added: "2.7"
  name:
    description:
      - A package name or package specifier with version, like C(name-1.0).
      - Comparison operators for package version are valid here C(>), C(<), C(>=), C(<=). Example - C(name>=1.0)
      - If a previous version is specified, the task also needs to turn C(allow_downgrade) on.
        See the C(allow_downgrade) documentation for caveats with downgrading packages.
      - When using state=latest, this can be C('*') which means run C(yum -y update).
      - You can also pass a url or a local path to a rpm file (using state=present).
        To operate on several packages this can accept a comma separated string of packages or (as of 2.0) a list of packages.
    aliases: [ pkg ]
    type: list
    elements: str
  exclude:
    description:
      - Package name(s) to exclude when state=present, or latest
    type: list
    elements: str
    version_added: "2.0"
  list:
    description:
      - "Package name to run the equivalent of C(yum list --show-duplicates <package>) against. In addition to listing packages,
        use can also list the following: C(installed), C(updates), C(available) and C(repos)."
      - This parameter is mutually exclusive with I(name).
    type: str
  state:
    description:
      - Whether to install (C(present) or C(installed), C(latest)), or remove (C(absent) or C(removed)) a package.
      - C(present) and C(installed) will simply ensure that a desired package is installed.
      - C(latest) will update the specified package if it's not of the latest available version.
      - C(absent) and C(removed) will remove the specified package.
      - Default is C(None), however in effect the default action is C(present) unless the C(autoremove) option is
        enabled for this module, then C(absent) is inferred.
    type: str
    choices: [ absent, installed, latest, present, removed ]
  enablerepo:
    description:
      - I(Repoid) of repositories to enable for the install/update operation.
        These repos will not persist beyond the transaction.
        When specifying multiple repos, separate them with a C(",").
      - As of Ansible 2.7, this can alternatively be a list instead of C(",")
        separated string
    type: list
    elements: str
    version_added: "0.9"
  disablerepo:
    description:
      - I(Repoid) of repositories to disable for the install/update operation.
        These repos will not persist beyond the transaction.
        When specifying multiple repos, separate them with a C(",").
      - As of Ansible 2.7, this can alternatively be a list instead of C(",")
        separated string
    type: list
    elements: str
    version_added: "0.9"
  conf_file:
    description:
      - The remote yum configuration file to use for the transaction.
    type: str
    version_added: "0.6"
  disable_gpg_check:
    description:
      - Whether to disable the GPG checking of signatures of packages being
        installed. Has an effect only if state is I(present) or I(latest).
    type: bool
    default: "no"
    version_added: "1.2"
  skip_broken:
    description:
      - Skip all unavailable packages or packages with broken dependencies
        without raising an error. Equivalent to passing the --skip-broken option.
    type: bool
    default: "no"
    version_added: "2.3"
  update_cache:
    description:
      - Force yum to check if cache is out of date and redownload if needed.
        Has an effect only if state is I(present) or I(latest).
    type: bool
    default: "no"
    aliases: [ expire-cache ]
    version_added: "1.9"
  validate_certs:
    description:
      - This only applies if using a https url as the source of the rpm. e.g. for localinstall. If set to C(false), the SSL certificates will not be validated.
      - This should only set to C(false) used on personally controlled sites using self-signed certificates as it avoids verifying the source site.
      - Prior to 2.1 the code worked as if this was set to C(true).
    type: bool
    default: "yes"
    version_added: "2.1"
  sslverify:
    description:
      - Disables SSL validation of the repository server for this transaction.
      - This should be set to C(false) if one of the configured repositories is using an untrusted or self-signed certificate.
    type: bool
    default: "yes"
    version_added: "2.13"
  update_only:
    description:
      - When using latest, only update installed packages. Do not install packages.
      - Has an effect only if state is I(latest)
    default: "no"
    type: bool
    version_added: "2.5"

  installroot:
    description:
      - Specifies an alternative installroot, relative to which all packages
        will be installed.
    default: "/"
    type: str
    version_added: "2.3"
  security:
    description:
      - If set to C(true), and C(state=latest) then only installs updates that have been marked security related.
    type: bool
    default: "no"
    version_added: "2.4"
  bugfix:
    description:
      - If set to C(true), and C(state=latest) then only installs updates that have been marked bugfix related.
    default: "no"
    type: bool
    version_added: "2.6"
  allow_downgrade:
    description:
      - Specify if the named package and version is allowed to downgrade
        a maybe already installed higher version of that package.
        Note that setting allow_downgrade=True can make this module
        behave in a non-idempotent way. The task could end up with a set
        of packages that does not match the complete list of specified
        packages to install (because dependencies between the downgraded
        package and others can cause changes to the packages which were
        in the earlier transaction).
    type: bool
    default: "no"
    version_added: "2.4"
  enable_plugin:
    description:
      - I(Plugin) name to enable for the install/update operation.
        The enabled plugin will not persist beyond the transaction.
    type: list
    elements: str
    version_added: "2.5"
  disable_plugin:
    description:
      - I(Plugin) name to disable for the install/update operation.
        The disabled plugins will not persist beyond the transaction.
    type: list
    elements: str
    version_added: "2.5"
  releasever:
    description:
      - Specifies an alternative release from which all packages will be
        installed.
    type: str
    version_added: "2.7"
  autoremove:
    description:
      - If C(true), removes all "leaf" packages from the system that were originally
        installed as dependencies of user-installed packages but which are no longer
        required by any such package. Should be used alone or when state is I(absent)
      - "NOTE: This feature requires yum >= 3.4.3 (RHEL/CentOS 7+)"
    type: bool
    default: "no"
    version_added: "2.7"
  disable_excludes:
    description:
      - Disable the excludes defined in YUM config files.
      - If set to C(all), disables all excludes.
      - If set to C(main), disable excludes defined in [main] in yum.conf.
      - If set to C(repoid), disable excludes defined for given repo id.
    type: str
    version_added: "2.7"
  download_only:
    description:
      - Only download the packages, do not install them.
    default: "no"
    type: bool
    version_added: "2.7"
  lock_timeout:
    description:
      - Amount of time to wait for the yum lockfile to be freed.
    required: false
    default: 30
    type: int
    version_added: "2.8"
  install_weak_deps:
    description:
      - Will also install all packages linked by a weak dependency relation.
      - "NOTE: This feature requires yum >= 4 (RHEL/CentOS 8+)"
    type: bool
    default: "yes"
    version_added: "2.8"
  download_dir:
    description:
      - Specifies an alternate directory to store packages.
      - Has an effect only if I(download_only) is specified.
    type: str
    version_added: "2.8"
  install_repoquery:
    description:
      - If repoquery is not available, install yum-utils. If the system is
        registered to RHN or an RHN Satellite, repoquery allows for querying
        all channels assigned to the system. It is also required to use the
        'list' parameter.
      - "NOTE: This will run and be logged as a separate yum transation which
        takes place before any other installation or removal."
      - "NOTE: This will use the system's default enabled repositories without
        regard for disablerepo/enablerepo given to the module."
    required: false
    version_added: "1.5"
    default: "yes"
    type: bool
  cacheonly:
    description:
      - Tells yum to run entirely from system cache; does not download or update metadata.
    default: "no"
    type: bool
    version_added: "2.12"
extends_documentation_fragment:
- action_common_attributes
- action_common_attributes.flow
attributes:
    action:
        details: In the case of yum, it has 2 action plugins that use it under the hood, M(ansible.builtin.yum) and M(ansible.builtin.package).
        support: partial
    async:
        support: none
    bypass_host_loop:
        support: none
    check_mode:
        support: full
    diff_mode:
        support: full
    platform:
        platforms: rhel
notes:
  - When used with a C(loop:) each package will be processed individually,
    it is much more efficient to pass the list directly to the I(name) option.
  - In versions prior to 1.9.2 this module installed and removed each package
    given to the yum module separately. This caused problems when packages
    specified by filename or url had to be installed or removed together. In
    1.9.2 this was fixed so that packages are installed in one yum
    transaction. However, if one of the packages adds a new yum repository
    that the other packages come from (such as epel-release) then that package
    needs to be installed in a separate task. This mimics yum's command line
    behaviour.
  - 'Yum itself has two types of groups.  "Package groups" are specified in the
    rpm itself while "environment groups" are specified in a separate file
    (usually by the distribution).  Unfortunately, this division becomes
    apparent to ansible users because ansible needs to operate on the group
    of packages in a single transaction and yum requires groups to be specified
    in different ways when used in that way.  Package groups are specified as
    "@development-tools" and environment groups are "@^gnome-desktop-environment".
    Use the "yum group list hidden ids" command to see which category of group the group
    you want to install falls into.'
  - 'The yum module does not support clearing yum cache in an idempotent way, so it
    was decided not to implement it, the only method is to use command and call the yum
    command directly, namely "command: yum clean all"
    https://github.com/ansible/ansible/pull/31450#issuecomment-352889579'
# informational: requirements for nodes
requirements:
- yum
author:
    - Ansible Core Team
    - Seth Vidal (@skvidal)
    - Eduard Snesarev (@verm666)
    - Berend De Schouwer (@berenddeschouwer)
    - Abhijeet Kasurde (@Akasurde)
    - Adam Miller (@maxamillion)
a	
- name: Install the latest version of Apache
  ansible.builtin.yum:
    name: httpd
    state: latest

- name: Install Apache >= 2.4
  ansible.builtin.yum:
    name: httpd>=2.4
    state: present

- name: Install a list of packages (suitable replacement for 2.11 loop deprecation warning)
  ansible.builtin.yum:
    name:
      - nginx
      - postgresql
      - postgresql-server
    state: present

- name: Install a list of packages with a list variable
  ansible.builtin.yum:
    name: "{{ packages }}"
  vars:
    packages:
    - httpd
    - httpd-tools

- name: Remove the Apache package
  ansible.builtin.yum:
    name: httpd
    state: absent

- name: Install the latest version of Apache from the testing repo
  ansible.builtin.yum:
    name: httpd
    enablerepo: testing
    state: present

- name: Install one specific version of Apache
  ansible.builtin.yum:
    name: httpd-2.2.29-1.4.amzn1
    state: present

- name: Upgrade all packages
  ansible.builtin.yum:
    name: '*'
    state: latest

- name: Upgrade all packages, excluding kernel & foo related packages
  ansible.builtin.yum:
    name: '*'
    state: latest
    exclude: kernel*,foo*

- name: Install the nginx rpm from a remote repo
  ansible.builtin.yum:
    name: http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
    state: present

- name: Install nginx rpm from a local file
  ansible.builtin.yum:
    name: /usr/local/src/nginx-release-centos-6-0.el6.ngx.noarch.rpm
    state: present

- name: Install the 'Development tools' package group
  ansible.builtin.yum:
    name: "@Development tools"
    state: present

- name: Install the 'Gnome desktop' environment group
  ansible.builtin.yum:
    name: "@^gnome-desktop-environment"
    state: present

- name: List ansible packages and register result to print with debug later
  ansible.builtin.yum:
    list: ansible
  register: result

- name: Install package with multiple repos enabled
  ansible.builtin.yum:
    name: sos
    enablerepo: "epel,ol7_latest"

- name: Install package with multiple repos disabled
  ansible.builtin.yum:
    name: sos
    disablerepo: "epel,ol7_latest"

- name: Download the nginx package but do not install it
  ansible.builtin.yum:
    name:
      - nginx
    state: latest
    download_only: true
)�
AnsibleModule)�get_best_parsable_locale)�
has_respawned�respawn_module)�	to_native�to_text)�	fetch_url)�YumDnf�yumdnf_argument_specNTF)�find_unfinished_transactions�find_ts_remaining)�
splitFilename�
compareEVR)�contextmanager)�
fetch_filez.%{epoch}:%{name}-%{version}-%{release}.%{arch}c���eZdZdZ�fd�Zd�Zd�Zed���Zd�Z	d�Z
dd
�Zefd�Z
efd�Zefd
�Zd�Zd�Zed���Zd�Zdd�Zd�Zd�Zd�Zd�Zd�Zed���Zd�Zd�Zed���Zd�Z �xZ!S) �	YumModulez4
    Yum Ansible module back-end implementation
    c���tt|���|��d|_d|_d|_dS)N�yumz/var/run/yum.pid)�superr�__init__�pkg_mgr_name�lockfile�	_yum_base)�self�module�	__class__s  ��8/usr/lib/python3.11/site-packages/ansible/modules/yum.pyrzYumModule.__init__�s=���	�i����'�'��/�/�/�!���*��
������c�F�t|j��dkr�	|jj�|jd��dS#t
jj$rH}dt|��vr*|j	�
d|jdz���n|�Yd}~dSd}~wwxYw|jD]t}	|jj�|���##t
jj$r;}dt|��vr|j	�d|z��n|�Yd}~�md}~wwxYwdS)N�rzrepository not foundzRepository %s not found.��msg)�len�
enablerepo�yum_base�repos�
enableRepor�Errors�YumBaseErrorrr�	fail_json�warn)r�e�rids   r!� _enablerepos_with_error_checkingz*YumModule._enablerepos_with_error_checking�sd���t����1�$�$�
��
�#�.�.�t��q�/A�B�B�B�B�B���:�*�
�
�
�*�g�a�j�j�8�8��K�)�)�.H�4�?�[\�K]�.]�)�^�^�^�^��G�_�^�^�^�^�^�����
������
 �
 �� ��M�'�2�2�3�7�7�7�7���z�.� � � �.�'�!�*�*�<�<���(�(�)C�c�)I�J�J�J�J���K�J�J�J�J����� ����
 �
 s/�*A�B"�=B�B"�/C�D�#1D�Dc���		t|jd��5}t|�����}ddd��n#1swxYwYn*#t$rtj|j��YdSwxYw|tj��krtj|j��dS	td|zd��5}|���}ddd��n#1swxYwY|���ddkrtj|j��dSn�#t$r�	tj
|d��n�#t$ru}|jtj
kr tj|j��Yd}~YdS|j�d|�d|j�d	t!|�����
��Yd}~nd}~wwxYwYnwxYwn#ttf$r}Yd}~dSd}~wwxYwdS)N�rFz
/proc/%d/stat��ZrzUnable to check PID z in  �: r%T)�openr�int�readline�
ValueError�os�unlink�getpid�split�IOError�kill�OSError�errno�ESRCHrr.r
)r�f�oldpid�statr0s     r!�is_lockfile_pid_validzYumModule.is_lockfile_pid_valid�s���$	�
��$�-��-�-�/�� ������.�.�F�/�/�/�/�/�/�/�/�/�/�/����/�/�/�/����
�
�
��	�$�-�(�(�(��u�u�
����
�����$�$��	�$�-�(�(�(��u�
{��/�F�2�C�8�8�(�A��:�:�<�<�D�(�(�(�(�(�(�(�(�(�(�(����(�(�(�(��:�:�<�<��?�c�)�)��I�d�m�,�,�,� �5�*���
{�
{�
{�	{��G�F�A�&�&�&�&���{�{�{��w�%�+�-�-��	�$�-�0�0�0�$�u�u�u�u�u�u��K�)�)�)�U[�U[�U[�]a�]j�]j�]j�lu�vw�lx�lx�lx�.y�)�z�z�z�z�z�z�z�z�����
{������
{��������!�	�	�	��5�5�5�5�5�����	����
�ts��A�"A�A�A
�
A�
A
�A�G�#A9�5G�8A9�93G�/D(�C#�D(�#C'�'D(�*C'�+:D(�'G�(
G�3E	�G�	
G�.G�G�G�6G�>G�G�G�G�
G�G�G.�)G.c���|jr|jStj��|_d|jj_d|jj_d|jj_|j|jj_|j	|jj_
|jr|j|jj_|jdkr,|j|jj_
|j|jj_|jr:t j�|j��r|j|jj_t!j��dkr}t+|jd��r|j���nNtj���}|jj�|��d|jj_|jr|j|jj_|j|jj_|jj	|jD]!}|jj�|���"|� ��nB#tB$r5}|j"�#dtI|��z���Yd}~nd}~wwxYw|jS)NrT�/�setCacheDir�Failure talking to yum: %sr%)%rr�YumBase�preconf�
debuglevel�
errorlevel�plugins�
enable_plugin�enabled_plugins�disable_plugin�disabled_plugins�
releasever�installroot�root�conf�	conf_filer<�path�exists�fn�geteuid�hasattrrK�misc�getCacheDirr*�cache�disable_excludes�	sslverifyr)�disablerepo�disableRepor2�	Exceptionrr.r
)r�cachedirr1r0s    r!r)zYumModule.yum_bases?���>�.	W��>�!�!�[�]�]�D�N�01�D�N�"�-�01�D�N�"�-�-1�D�N�"�*�59�5G�D�N�"�2�6:�6I�D�N�"�3���
D�48�O���&�1���3�&�&�/3�.>���&�+�26�2B���#�/��~�
;�"�'�.�.���"@�"@�
;�,0�N���&�)��z�|�|�q� � ��4�>�=�9�9�2��N�.�.�0�0�0�0�"�x�3�3�5�5�H��N�(�4�4�X�>�>�>�01�D�N�'�-��$�
M�7;�7L���#�4�
-1�N�D�N��)�
�M���
W��+�9�9�C��M�'�3�3�C�8�8�8�8��5�5�7�7�7�7���
W�
W�
W���%�%�*F��ST���*U�%�V�V�V�V�V�V�V�V�����
W�����~�s�/=H-�-
I,�7+I'�'I,c	��t|d��r|jS|j�d|j�d|j�d|j�d|j��	S)N�ui_envra�:�-�.)r_rj�epoch�name�version�release�arch)r�pos  r!�po_to_envrazYumModule.po_to_envraCsI���2�z�"�"�	��;��#%�8�8�8�R�W�W�W�b�j�j�j�"�*�*�*�b�g�g�V�Vr"c�x�|���}tjdkr|j�d���}n|j���}|d}|D]]}|�|j�����s,|�|j�����rdS�^tjdkrh|d}|D]]}|�|j�����s,|�|j�����rdS�^dS)N)��T)�
return_evgrpsrr5F)	�lowerr�__version_info__r)�doGroupLists�endswithro�groupid�
environmentid)rro�
name_lower�groups_list�groups�group�envs�envs        r!�is_group_env_installedz YumModule.is_group_env_installedIs9���Z�Z�\�\�
���6�)�)��-�4�4�4�4�H�H�K�K��-�4�4�6�6�K��Q����	�	�E��"�"�5�:�#3�#3�#5�#5�6�6�
�*�:M�:M�e�m�Na�Na�Nc�Nc�:d�:d�
��t�t�
���6�)�)��q�>�D��
 �
 ���&�&�s�x�~�~�'7�'7�8�8� �J�<O�<O�PS�Pa�Pg�Pg�Pi�Pi�<j�<j� ��4�4� ��ur"NFc�4��|�d}|s�g}	�jj�|g��\}}}||z}|s/|s-|��j�|����nB#t
$r5}�j�dt|��z���Yd}~nd}~wwxYw�fd�|D��Sts�j�
dd���a	tdd	||g}	d
|vr|	�d���jdkr|	�d
�jg��t�j��}
t|
|
|
���}�j�|	|���\}}
}|dkr%d|
vr!�j�d|	�d|�����d|
vrd}
d�|
�dd���d��D��}|sW|sUtdd	|d|g}	�jdkr|	�d
�jg���j�|	|���\}}}nd\}}}|dkr(d|vr$�j�d|	�d||z�����d|vrd}|d�|�dd���d��D��z
}|S)Nz/%{epoch}:%{name}-%{version}-%{release}.%{arch}
rLr%c�:��g|]}��|����S��rt��.0�prs  �r!�
<listcomp>z*YumModule.is_installed.<locals>.<listcomp>n�'���6�6�6�A�D�$�$�Q�'�'�6�6�6r"�rpmT��requiredz-q�--qf�*�-arJz--root��LANG�LC_ALL�LC_MESSAGES��environ_updaterzis not installedzError from rpm: r7�c�:�g|]}|����|��Sr���strip�r�r�s  r!r�z*YumModule.is_installed.<locals>.<listcomp>�s%��S�S�S�!������S�A�S�S�Sr"z(none)�0�
�--whatprovides�rr�r�zno package providesc�:�g|]}|����|��Sr�r�r�s  r!r�z*YumModule.is_installed.<locals>.<listcomp>�s%��U�U�U�1�1�7�7�9�9�U�Q�U�U�Ur")r)�rpmdb�matchPackageNames�extend�returnInstalledPackagesByDeprgrr.r
�rpmbin�get_bin_path�appendrWr�dict�run_command�replacer?)r�repoq�pkgspec�qf�is_pkg�pkgsr0�m�_�cmd�locale�lang_env�rc�out�err�rc2�out2�err2s`                 r!�is_installedzYumModule.is_installed`s)���
�:�C�B��.	��D�
W��-�-�?�?��	�J�J���1�a��1�u���U�F�U��K�K��
� J� J�7� S� S�T�T�T����
W�
W�
W���%�%�*F��ST���*U�%�V�V�V�V�V�V�V�V�����
W����7�6�6�6��6�6�6�6��
H���1�1�%�$�1�G�G���4���W�5�C��g�~�~��
�
�4� � � ���3�&�&��
�
�H�d�&6�7�8�8�8�.�d�k�:�:�F����F�K�K�K�H��;�2�2�3�x�2�P�P�L�B��S��Q�w�w�-�S�8�8���%�%�%�c�c�c�3�3�*O�%�P�P�P�!�S�(�(���S�S�s�{�{�8�S�9�9�?�?��E�E�S�S�S�D��
.��
.��t�V�R�1A�7�K���#�s�*�*��J�J��$�*:�;�<�<�<�"&�+�"9�"9�#�h�"9�"W�"W���T�4�4�"-���T�4��a�x�x�1��=�=���%�%�%�c�c�c�3�QU�:�:�*V�%�W�W�W�$��,�,����U�U����X�s� ;� ;� A� A�$� G� G�U�U�U�U�D��Ks�AA&�&
B%�0+B � B%c�f��|s�g}	�jj�|g��\}}}||z}|s-|��j�|����nB#t
$r5}�j�dt|��z���Yd}~nd}~wwxYw�fd�|D��St|��}dd�
�j��g}	|�|	��dd�
�j��g}	|�|	���j
r|�d�j
z��|d||gz}
�j�|
��\}}}
|d	krd
�|�d��D��S�j�d|
�d
|
�����gS)NrLr%c�:��g|]}��|����Sr�r�r�s  �r!r�z*YumModule.is_available.<locals>.<listcomp>�r�r"�
--disablerepo�,�--enablerepo�--releasever=%sr�rc�:�g|]}|����|��Sr�r�r�s  r!r�z*YumModule.is_available.<locals>.<listcomp>��%��@�@�@�a�a�g�g�i�i�@��@�@�@r"r��Error from repoquery: r7)r)�pkgSackr�r��returnPackagesByDeprgrr.r
�list�joinrer(rVr�r?)rr�r�r�r�r0r�r��myrepoq�r_cmdr�r�r�r�s`             r!�is_availablezYumModule.is_available�s�����	W��D�
W��-�/�A�A�7�)�L�L���1�a��1�u���L��K�K��
� A� A�'� J� J�K�K�K����
W�
W�
W���%�%�*F��ST���*U�%�V�V�V�V�V�V�V�V�����
W����7�6�6�6��6�6�6�6��5�k�k�G�$�c�h�h�t�/?�&@�&@�A�E��N�N�5�!�!�!�#�S�X�X�d�o�%>�%>�?�E��N�N�5�!�!�!���
D����0�4�?�B�C�C�C��V�R��1�1�C��;�2�2�3�7�7�L�B��S��Q�w�w�@�@�3�9�9�T�?�?�@�@�@�@���%�%�%�C�C�C�QT�QT�*U�%�V�V�V��	s�AA � 
B�*+B�Bc�&���|s�g}g�	�j�|���j�|��z}|s)�jj�|g��\}}}||z}�j�d���j�nB#t$r5}�j�	dt|��z���Yd}~nd}~wwxYw�fd�|D��}t�fd�|D����St|��}	dd�
�j��g}
|	�|
��d	d�
�j��g}
|	�|
���jr|	�d
�jz��|	dd||gz}�j�|��\}}
}|d
kr,td�|
�d��D����S�j�	d|�d|�����t��S)N�updates)�	pkgnarrowrLr%c3�$�K�|]
}|�v�|V��dS�Nr�)r��pkgr�s  �r!�	<genexpr>z&YumModule.is_update.<locals>.<genexpr>�s'�����=�=�s�c�W�n�n�s�n�n�n�n�=�=r"c3�B�K�|]}��|��V��dSr�r�r�s  �r!r�z&YumModule.is_update.<locals>.<genexpr>�s1�����<�<�q�t�'�'��*�*�<�<�<�<�<�<r"r�r�r�r�z--pkgnarrow=updatesr�rc3�BK�|]}|����|V��dSr�r�r�s  r!r�z&YumModule.is_update.<locals>.<genexpr>�s/����C�C�������C�1�C�C�C�C�C�Cr"r�r�r7)r)r�r�r�r��doPackageListsr�rgrr.r
�setr�r�rer�r(rVr�r?)rr�r�r�r�r0r�r��retpkgsr�r�r�r�r�r�r�s`              @r!�	is_updatezYumModule.is_update�sG�����$	W��D��G�
W��}�8�8��A�A��M�>�>�w�G�G�H���!�"�m�3�E�E�w�i�P�P�G�A�q�!��q�5�D��-�6�6��6�K�K�S�����
W�
W�
W���%�%�*F��ST���*U�%�V�V�V�V�V�V�V�V�����
W����>�=�=�=�d�=�=�=�G��<�<�<�<�G�<�<�<�<�<�<��5�k�k�G�$�c�h�h�t�/?�&@�&@�A�E��N�N�5�!�!�!�#�S�X�X�d�o�%>�%>�?�E��N�N�5�!�!�!���
D����0�4�?�B�C�C�C��2�F�B��H�H�C��;�2�2�3�7�7�L�B��S��Q�w�w��C�C�c�i�i��o�o�C�C�C�C�C�C���%�%�%�C�C�C�QT�QT�*U�%�V�V�V��u�u�s�BB�
C
�+C�C
c����|�s�g}		�j�|���j�|��z}n�#t$r�}dt	|��vr��jr.�j��jddd�jzgz��n$�j��jddgz���j�|���j�|��z}n�Yd}~nd}~wwxYw|s��jj	�
|g��dd�\}}|�|��|�|���jj�
|g��dd�\}}|�|��|�|��nB#t$r5}�j�
dt	|��z���Yd}~nd}~wwxYwt�fd	�|D����St|��}d
d��j��g}	|�|	��dd��j��g}	|�|	���jr|�d�jz��|d
|d|gz}
�j�|
��\}}}
|d
||gz}
�j�|
��\}}}|dkrF|dkr@||z
}d�|�d��D��}|s��|||���}|S�j�
d|
�d|
|z�����t��S)Nz*repomd.xml signature could not be verified�	makecache�fastr�rr5rLr%c3�B�K�|]}��|��V��dSr�r�r�s  �r!r�z*YumModule.what_provides.<locals>.<genexpr>s1�����9�9�q�t�'�'��*�*�9�9�9�9�9�9r"r�r�r�r�r�c�:�h|]}|����|��Sr�r�r�s  r!�	<setcomp>z*YumModule.what_provides.<locals>.<setcomp>r�r"r��r�r�r7)r)r�r�rgr
rVrr��yum_basecmdr�r�r�r�r.r�r�r�rer(r?r�)rr��req_specr�r�r0�
exact_matches�glob_matchesr�r�r�r�r�r�r�r�r�s`                r!�
what_provideszYumModule.what_provides�s�����8	^��D�
W���=�<�<�X�F�F��
�B�B�8�L�L�M�D�D�� ����D�y�QR�|�|�S�S��?�^� �K�3�3�D�4D��U[�]n�qu�rA�^A�HB�5B�C�C�C�C� �K�3�3�D�4D��U[�G\�4\�]�]�]�#�}�@�@��J�J� �M�F�F�x�P�P� Q������������������.�26�-�2G�2Y�2Y�[c�Zd�2e�2e�fg�hi�fi�2j�/�M�<��K�K�
�.�.�.��K�K��-�-�-�26�-�2E�2W�2W�Ya�Xb�2c�2c�de�fg�dg�2h�/�M�<��K�K�
�.�.�.��K�K��-�-�-����
W�
W�
W���%�%�*F��ST���*U�%�V�V�V�V�V�V�V�V�����
W�����9�9�9�9�D�9�9�9�9�9�9��5�k�k�G�$�c�h�h�t�/?�&@�&@�A�E��N�N�5�!�!�!�#�S�X�X�d�o�%>�%>�?�E��N�N�5�!�!�!���
D����0�4�?�B�C�C�C��V�R�)9�8�D�D�C��;�2�2�3�7�7�L�B��S��V�R��2�2�C�"�k�5�5�c�:�:�O�C��t��Q�w�w�3�!�8�8��t���@�@�3�9�9�T�?�?�@�@�@���E��,�,�U�H��,�D�D�D�����%�%�%�C�C�C�QT�W[�Q[�Q[�*\�%�]�]�]��u�u�s:�5?�F$�
C4�	B!C/�*F$�/C4�4B/F$�$
G#�.+G�G#c�>�g}ts|Sd�|D��}t��}|D]t}t|��}|D]`}|\}}	t|	��\}
}}}
}|D]A}|
�d|��}|
|dkr,||dkr ||vr|�|
�d|����n�B�a�u|S)zr
        checks the package list to see if any packages are
        involved in an incomplete transaction
        c3�4K�|]}t|��V��dSr�)r)r�r�s  r!r�z/YumModule.transaction_exists.<locals>.<genexpr>+s*����@�@��-��,�,�@�@�@�@�@�@r"rlrrw)�transaction_helpersrrrr�)r�pkglist�	conflicts�pkglist_nvreas�unfinished_transactions�trans�steps�step�action�	step_spec�n�vr4r0�ar��labels                 r!�transaction_existszYumModule.transaction_existss���	�"�	���A�@��@�@�@��#?�"@�"@��,�	�	�E�%�e�,�,�E��
�
��'+�#���"/�	�":�":���A�q�!�Q�*���C�()�q�q�!�!�,�E��C��F�{�{�q�C��F�{�{� �	�1�1�%�,�,����1�1�-=�>�>�>�����
� �r"c
�V�tj��}|�tj��t	j|tj��}	|�|��}n1#tj$r}Yd}~t	j	|��dSd}~wwxYw	t	j	|��n#t	j	|��wxYw|tj
pd�d|tj�d|tj�d|tj
�d|tj��	S)z%return envra of a local rpm passed inNr�rkrlrm)r��TransactionSet�
setVSFlags�_RPMVSF_NOSIGNATURESr<r8�O_RDONLY�hdrFromFdno�error�close�RPMTAG_EPOCH�RPMTAG_NAME�RPMTAG_VERSION�RPMTAG_RELEASE�RPMTAG_ARCH)rr[�ts�fd�headerr0s      r!�local_envrazYumModule.local_envraDs���
�
!�
!��
�
�
�c�.�/�/�/�
�W�T�2�;�
'�
'��	��^�^�B�'�'�F�F���y�	�	�	��4�4�4��H�R�L�L�L�L�L�����	����
�
�H�R�L�L�L�L��B�H�R�L�L�L�L����
�3�#�$�+��+�+��3�?�#�#�#��3�%�&�&�&��3�%�&�&�&��3�?�#�#�
�	
s*�A)�(B0�)B�8B0�B�B0�0Cc#�K�d}ddg}tjd��tjd��g}	|jjj�r]|jjjdv�rI|jjjrN||jjjz}|jjj}|jjjr|dz|jjjz}n�d|jjjvr{|jjj�d��d	�d
��d}|jjj�d�	|��d��}|r4|dz}|D]+}tjd
d|z|��tj|dz<�,n&|D]#}|jjjtj|dz<�$dV�n#tjj$r�wxYw	|D]I}tjd�	|����r tjd�	|��=�J|d	r|d	tjd<|dr|dtjd<dSdS#|D]I}tjd�	|����r tjd�	|��=�J|d	r|d	tjd<|dr|dtjd<wxYw)Nr��http�https�
http_proxy�https_proxy)�_none_rk�@rz//���z{0}@z	(http://)z\g<1>�_proxyz	{0}_proxyr$)r<�getenvr)rY�proxy�proxy_username�proxy_passwordr?r��format�re�sub�environrr,r-)r�namepass�scheme�
old_proxy_env�	proxy_url�items      r!�
set_env_proxyzYumModule.set_env_proxyYs�������'�"����<�0�0�"�)�M�2J�2J�K�
�!	=��}�!�'�
O�D�M�,>�,D�K�,W�,W��=�%�4�^�'�$�-�*<�*K�K�H� $�
� 2� 8�I��}�)�8�V�#+�c�>�D�M�4F�4U�#U����D�M�.�4�4�4�#�}�1�7�=�=�c�B�B�1�E�K�K�D�Q�Q�RT�U�H� $�
� 2� 8� @� @����x�AX�AX�Z\� ]� ]�I��	O�'�#�~�H� &����68�f�(�$�x�/��7�7��
�4�(�?�3�3��!'�O�O��6:�m�6H�6N��
�4�(�?�3�3��E�E�E�E���z�&�	�	�	��	����
�
�
=�
=���9�[�/�/��5�5�6�6�=��
�;�#5�#5�d�#;�#;�<���Q��
<�+8��+;��
�<�(��Q��
=�,9�!�,<��
�=�)�)�)�
=�
=���
=�
=���9�[�/�/��5�5�6�6�=��
�;�#5�#5�d�#;�#;�<���Q��
<�+8��+;��
�<�(��Q��
=�,9�!�,<��
�=�)�<�<�<�<s�E3F&�%I
�&F<�<I
�
BKc���|���r6|�d��dkr|�d��\}}}}}}nd|iS|||||||�d|�d|�d|�d|��	d�}|dkrd|d	<nd
|d	<|S)N�|��
error_parsingrkrlrm)rorrrnrqrp�repo�envra�	installed�yumstate�	available)r��countr?)	r�pkgstrr�r0r�r4r�r&�ds	         r!�pkg_to_dictzYumModule.pkg_to_dict�s����<�<�>�>�	-�f�l�l�3�/�/�1�4�4�"(�,�,�s�"3�"3��A�q�!�Q��4�4�#�V�,�,�������)*���A�A�A�q�q�q�!�!�!�Q�Q�7�
�
���;���'�A�j�M�M�'�A�j�M��r"�	%{repoid}c��|d|dgz}|jr|�d|jzg��|j�|��\}}}|dkr,t	d�|�d��D����SgS)Nr�r�r�rc3�BK�|]}|����|V��dSr�r�r�s  r!r�z%YumModule.repolist.<locals>.<genexpr>�s/����?�?�Q�Q�W�W�Y�Y�?�q�?�?�?�?�?�?r"r�)rVr�rr�r�r?)rr�r�r�r�r�r�s       r!�repolistzYumModule.repolist�s����v�r�4�(�(���?�	>��J�J�)�D�O�;�<�=�=�=��[�,�,�S�1�1�
��C��
��7�7��?�?�#�)�)�D�/�/�?�?�?�?�?�?��Ir"c	����d}d}|dddg}�jr/|�dd��j��g���jr/|�dd��j��g���jd	kr|�d
�jg���jr0tj��j��r|d�jgz
}|dkr1�fd
�t��
|d|�����D��S|dkr1�fd�t��|d|�����D��S|dkr1�fd�t��|d|�����D��S|dkr,d�t��
|����D��S�fd�t��
|||�����|||���z��D��S)Nz8%{name}|%{epoch}|%{version}|%{release}|%{arch}|%{repoid}z9%{name}|%{epoch}|%{version}|%{release}|%{arch}|installed
�--show-duplicates�	--plugins�--quietr�r�r�rJ�
--installroot�-cr(c�b��g|]+}|������|����,Sr��r�r.r�s  �r!r�z(YumModule.list_stuff.<locals>.<listcomp>�s9���y�y�y�A�op�ov�ov�ox�ox�y�D�$�$�Q�'�'�y�y�yr"r�r�r�c�b��g|]+}|������|����,Sr�r:r�s  �r!r�z(YumModule.list_stuff.<locals>.<listcomp>�s9���i�i�i�A�_`�_f�_f�_h�_h�i�D�$�$�Q�'�'�i�i�ir"r*c�b��g|]+}|������|����,Sr�r:r�s  �r!r�z(YumModule.list_stuff.<locals>.<listcomp>�s9���l�l�l�A�bc�bi�bi�bk�bk�l�D�$�$�Q�'�'�l�l�lr"r*c�X�g|]'}|����t|d�����(S)�enabled)�repoid�state)r�r�)r�ros  r!r�z(YumModule.list_stuff.<locals>.<listcomp>�s7��p�p�p�4�cg�cm�cm�co�co�p�D��I�6�6�6�p�p�pr"c�b��g|]+}|������|����,Sr�r:r�s  �r!r�z(YumModule.list_stuff.<locals>.<listcomp>�sE���
�
�
�$%��w�w�y�y�
����Q���
�
�
r")rer�r�r(rWrZr<r[r\�sortedr�r�r�r2)r�repoquerybin�stuffr��is_installed_qfr�s`     r!�
list_stuffzYumModule.list_stuff�s9���
G��V���2�K��K����	H��L�L�/�3�8�8�D�4D�+E�+E�F�G�G�G��?�	F��L�L�.�#�(�(�4�?�*C�*C�D�E�E�E���s�"�"��L�L�/�4�+;�<�=�=�=��>�	,�b�g�n�n�T�^�<�<�	,��d�D�N�+�+�E��K���y�y�y�y���8I�8I�%�QU�Zi�8I�8j�8j�1k�1k�y�y�y�y��I���i�i�i�i�����u�d�WY��8Z�8Z�1[�1[�i�i�i�i��K���l�l�l�l���8I�8I�%�QU�Z\�8I�8]�8]�1^�1^�l�l�l�l��G���p�p�6�$�-�-�X]�J^�J^�C_�C_�p�p�p�p�
�
�
�
��4�$�$�U�E�o�$�F�F��IZ�IZ�[`�bg�ln�IZ�Io�Io�o�p�p�
�
�
�	
r"c�b�|j|gz|z}|jr|�d|jzg��|js|�ddg��|jjr2|j�d|dt|������nt|���|d<t|j��}t|||�	��}|j�	||�
��\}}	}
|dkr9|D]6}d|vr0d
|z|	vsd|z|
vr"d|z}
|j�
d|
|����7||d<|d�|	��|dxx|
z
cc<d|d<d|	vr|dksd|
vrd|d<|dkrd|d<|jj
di|��d|	p|
vrd|d<d|d<|jj
di|��|S)Nr�z--setoptzsslverify=0T�results)r(��changedrH�changesrKr�r�r$�://zNo package %s available.zCannot open: %s. Skipping.z$Package at %s could not be installedF)rJr&r�r�r&rJz
Nothing to dorzdoes not have any packageszNo space left on devicer�)r�rVr�rdr�
check_mode�	exit_jsonr�rr�r.r�)r�itemsr�r��resr�r�r�r�r�r��specs            r!�exec_installzYumModule.exec_install�s<����&��)�D�0���?�	>��J�J�)�D�O�;�<�=�=�=��~�	4��J�J�
�M�2�3�3�3��;�!�	2��K�!�!�$��I��PT�_c�Pd�Pd�Pd�!�e�e�e�e�!�D�1�1�1�C�	�N�)�$�+�6�6���V�F��G�G�G���{�.�.�s�8�.�L�L���C��
��7�7��
I�
I���T�M�M�'A�D�'H�C�'O�'O�So�rv�Sv�z}�S}�S}�@�4�G�C��K�)�)�%�S�R�)�H�H�H����D�	��I����c�"�"�"��E�
�
�
�c��
�
�
���I���s�"�"�r�Q�w�w�4P�TW�4W�4W�"�C�	�N�
��7�7�"�C�	�N�!�D�K�!�(�(�C�(�(�(�%����4�4�"�C�	�N�2�C��J�!�D�K�!�(�(�C�(�(�(��
r"c��
�g}g}i}g|d<d|d<d|d<d|d<|D�]$}d}d}|�d��sd	|v�r{d	|vrgtj�|��sH|dxxd
|zz
cc<|d�d
|z��d|d<|jjd!i|��d	|vrs|���5t|j|��}	|	�d��sd|	z}
tj	|	|
��|
}	ddd��n#1swxYwYn|}	|�
|	��}|�|j�d
|z���|�||��}|r)|d�|d�d|	�d�����{t|��\}
}}}}|�||
��}t|��dkr}t|d��\}}}}}t|d��\}}}}}|pd}|pd}t|||f|||f��}|dkr#||kr|D]}|�|��r|g}�t|��dkrO|d}t|��\}}} }!}"|!pd}!t|!|| f|||f��}|dkr
|jrd}n|dkr���|	}�nS|�d��r|�|��r���|}�n#t%ddg���t%|����sC|�||d���}|r)|d�|d�d|�d�����@|�||��}#|#sH|dxxd|zz
cc<|d�d|z��d|d<|jjd!i|��|�|#��}$|$r=|dxxdd�|$��zz
cc<d|d<|jjd!i|��d}%|#D]?}&|�||&d���r%d}%|d�|&�d|�d���n�@|%s6|�||��r d}%|d�d|z��|%r��t|jrr|#D]o}	t|	��\}
}}}}|�||
d���}'|'r>t|'d��\}}} }!}"t|!|| f|||f��}|dkrd}�kd}n�p|}|r|jr|�|����|�|����&|r|�|d||��}|r|�|d ||��}|S)"NrHr�r&rr�FrJ�.rpmrL�)No RPM file matching '%s' found on system�z%s.rpm�4Failed to get envra information from RPM package: %sr%z providing z is already installedr5r$r�Trr��?�r��>No package matching '%s' found available, installed or updated�~�4The following packages have pending transactions: %s�, �}z)package providing %s is already installed�	downgrade�installr�)r|r<r[r\r�rr.r!r�renamer
r�rr'r�allow_downgrade�
startswithr�r��intersectionr�r�r�rR)(rrOr�r��downgrade_pkgsrPrQr��downgrade_candidate�package�new_package_pathr'�installed_pkgsro�ver�relrnrr�	cur_name0�cur_ver0�cur_rel0�
cur_epoch0�	cur_arch0�	cur_name1�cur_ver1�cur_rel1�
cur_epoch1�	cur_arch1�compare�
installed_pkg�cur_name�cur_ver�cur_rel�	cur_epoch�cur_archr�r��found�this�	inst_pkgss(                                        r!r`zYumModule.install�sm����������I����E�
���D�	���I���Y	!�Y	!�D��C�"'���}�}�V�$�$�O
���
�
���$�$�R�W�^�^�D�-A�-A�$���J�J�J�"M�PT�"T�T�J�J�J��	�N�)�)�*U�X\�*\�]�]�]� #�C��I�)�D�K�)�0�0�C�0�0�0��D�=�=��+�+�-�-�7�7�",�T�[�$�"?�"?��&�/�/��7�7�7�08�'�/A�,��I�g�/?�@�@�@�&6�G�7�7�7�7�7�7�7�7�7�7�7����7�7�7�7��#�G��(�(��1�1���=��K�)�)�.d�gk�.k�)�l�l�l�!%�!2�!2�5�%�!@�!@��!���	�N�)�)�Tb�cd�Te�Te�Te�gn�gn�gn�*o�p�p�p��0=�e�0D�0D�-��s�C���!%�!2�!2�5�$�!?�!?���~�&�&�!�+�+�MZ�[i�jk�[l�Mm�Mm�J�Y��(�J�	�MZ�[i�jk�[l�Mm�Mm�J�Y��(�J�	�!+�!2�s�J�!+�!2�s�J�(�*�h��)I�J�X`�bj�Kk�l�l�G��!�|�|�	�Y�(>�(>�-;�A�A�M�,�5�5�d�;�;�A�2?�����~�&�&�!�+�+�$2�1�$5�M�HU�Vc�Hd�Hd�E�X�w���H� )� 0�S�I�(�)�W�g�)F��PS�UX�HY�Z�Z�G�
��{�{�t�';�{�.2�+�+� �A��� �
�������%�%�P
��.�.�t�4�4�������C��:���3�3�C��I�I�>�>�!�%)�%6�%6�u�d�4�%6�%P�%P�N�%�!��I��-�-�Xf�gh�Xi�Xi�Xi�ko�ko�ko�.p�q�q�q� ��,�,�U�D�9�9���1���J�J�J�"b�ei�"i�i�J�J�J��	�N�)�)�*j�mq�*q�r�r�r� #�C��I�)�D�K�)�0�0�C�0�0�0�!�3�3�G�<�<�	��1���J�J�J�"X�[_�[d�[d�en�[o�[o�"o�o�J�J�J� #�C��I�)�D�K�)�0�0�C�0�0�0�
��#���D��(�(���T�(�B�B�� $���I��-�-�X\�X\�X\�^b�^b�^b�.c�d�d�d�����d��(�(���5�5�d� $���I��-�-�.Y�]a�.b�c�c�c����
�'�&�#*�&�&��9F�g�8N�8N�5��s�C���%)�$5�$5�e�T�$�$5�$O�$O�	�$�&�P]�^g�hi�^j�Pk�Pk�M�X�w���H�&0�)�W�g�1N�QV�X[�]`�Pa�&b�&b�G�&��{�{�6:� 3� 3�6;� 3� %��&���"�
!�t�';�
!��%�%�c�*�*�*�*����C� � � � ��	M��#�#�E�;���L�L�C��	A��#�#�E�9�d�C�@�@�C��
s�AD�D	�D	c��g}i}g|d<d|d<d|d<d|d<|D]y}|�d��r|�|��}n|�||��}|r|�|���[|d�d	|z���z|�rg|jjr2|j�d
|dt|������nt|���|d
<|jr|j	dgz|z}n|j	dgz|z}|j�
|��\}}	}
||d<|d�|	��|
|d<|dkr9|jr d|	vr|j�d���n|jjdi|��d|_|D]a}|�d��r|�|��}n|�||d
���}|rd|z|d<|jjdi|���bd
|d<|S)NrHr�r&FrJrr�rz%s is not installedT)�removedrIrK�
autoremove�removezNo such commandzJVersion of YUM too old for autoremove: Requires yum 3.4.3 (RHEL/CentOS 7+)r%rYz!Package '%s' couldn't be removed!r�)
rcr�r�r�rrMrNr�r�r�r�r.r)rrOr�r�rPr�r(r�r�r�r�s           r!r�zYumModule.remove�s���������I����E�
���I����D�	��		C�		C�C��~�~�c�"�"�
:� �7�7��<�<�	�	� �-�-�e�S�9�9�	��
C����C� � � � ��I��%�%�&;�c�&A�B�B�B�B��+	"��{�%�
4���%�%�d�C�	�N�TX�ae�Tf�Tf�Tf�%�g�g�g�g�!%�d�!3�!3�!3��I����
;��&�,��7�$�>����&�(��3�d�:���;�2�2�3�7�7�L�B��S��C��I��	�N�!�!�#�&�&�&��C��J��Q�w�w��?�1�'8�C�'?�'?��K�)�)�.z�)�{�{�{�{�)�D�K�)�0�0�C�0�0�0�"�D�N��
1�
1���>�>�#�&�&�K� $� ;� ;�C� @� @�I�I� $� 1� 1�%��T� 1� J� J�I��1�"E�s�!J�C��J�)�D�K�)�0�0�C�0�0�0��!�C�	�N��
r"c���|jr4|j�|jdgzd|jzgz��\}}}n'|j�|jdgz��\}}}|||fS)Nzcheck-updater�)rVrr�r�)rr�r�r�s    r!�run_check_updatezYumModule.run_check_update�sy���?�	X��;�2�2�4�3C�~�FV�3V�Zk�nr�n}�Z}�Y~�3~���L�B��S�S��;�2�2�4�3C�~�FV�3V�W�W�L�B��S��3��|�r"c���d�d�|���D����}tjdd|��}i}i}|�d��D]�}|���}	d|vst|��dvs
d|dvr�7|d|d	|d
}}}|�dd	��\}}	||vrg||<||�||	|d���t|��dkrY|d
|d|d}}}
|
�dd	��\}
}|
|vrg||
<||
�|||d�����||fS)Nr�c3�K�|]}|�|V��	dSr�r�)r��ls  r!r�z/YumModule.parse_check_update.<locals>.<genexpr>�s'����J�J�q��J��J�J�J�J�J�Jr"z	\n\W+(.*)z \1r�)rv�rmrr$r5)rp�distr&r�rvrwr$)r��
splitlinesrrr?r'�rsplitr�)�check_update_outputr�r��	obsoletes�liner�rpr&ror��obsolete_pkg�obsolete_version�
obsolete_repo�
obsolete_name�
obsolete_dists               r!�parse_check_updatezYumModule.parse_check_update�s����i�i�J�J�$7�$B�$B�$D�$D�J�J�J�K�K���f�\�6�3�/�/�����	��I�I�d�O�O�	}�	}�D��:�:�<�<�D�
��d�{�{�c�$�i�i�v�5�5��D��G�9K�9K��!%�a��$�q�'�4��7�$��C����C��+�+�J�D�$��7�"�"� "���
��D�M� � �W�d�D�!Q�!Q�R�R�R��4�y�y�A�~�~�@D�Q���a��RV�WX�RY�
�.��/;�/B�/B�3��/J�/J�,�
�}� �	�1�1�/1�I�m�,��-�(�/�/�<L�Vc�mz�0{�0{�|�|�|���	�!�!r"c
���i}g|d<d|d<d|d<d|d<i}g|d<g|d	<i}i}d}|jdd�}d
|vrd}|���\}	}
}|	dkr|r|d�d��|S|	d
kr|�|
��\}}n"|	dkr||d<|	|d<|jjd.i|��|rF|�d��t
|�����}t��}
�n9t
��}t��}
|D�]}|�	d��r1|d�|��|�
|���I|�d��r�d|vr�tj
�|��sH|dxxd|zz
cc<|d�d|z��d|d<|jjd.i|��|�|��}|�|j�d|z���|�||��r|d�|��n|d	�|����Md|vr�|���5t%|j|��}ddd��n#1swxYwY|�|��}|�|j�d|z���|�||��r|d�|��n|d	�|����|�||��r|d�|��n|d	�|��|�||��}|sH|dxxd|zz
cc<|d�d|z��d|d<|jjd.i|��d}|D]m}||d	vr|�||��rd}nHt+|��\}}}}}||dvr(||vr$d}|�
|��||kr||
|<n�n|�||��s'|jr |d�d|z����r|r |d�d|z�����|�|��}|rn|dxxdd�|��zz
cc<|d�dd�|��z��d|d<|jjd.i|����g}|D]�}|�	d��r|�|df���/||vrL|
|}||d}|�|d|�d|d�d |d!�d"|d#��f���||D]3}|�||d�d |d!�d"|d#��f���4��|jrtg|�$��|d%<nt|d	|�$��|d%<|r||d&<|jjr|s|d	rd|d<|S|jr|�d'|jzg��|r%|j�|��\}	}
}d|d<�n�|jr�|dr�|dg|dzz
}t;|j��}t|||�(��}|j�||�)��\}	}
}|
������}|�d*��s|�d+��sd|d<n�gd,�\}	}
}n�|d	s	|r�|js�|d	g|d	z|dzz
}t;|j��}t|||�(��}|j�||�)��\}	}
}|
������}|�d*��s|�d+��sd|d<ngd,�\}	}
}|	|d<|dxx|z
cc<|d�|
��|	rd|d-<|S)/NrHr�r&FrJrr��updater`r�Tz/Nothing to do here, all packages are up to date�dr$rrTrLrUrVrWr%rZr[z@Packages providing %s not installed due to update_only specifiedz(All packages providing %s are up to dater\r]�zbecause of (at least) rlrprmr�z from r&)r(�updatedrKr�r�r�r�zno packages marked for updatez
nothing to dor��failedr�) r�r�r�r�rr.r��keysr�rc�addr|r<r[r\r
r�r!rr�r�r�update_onlyr�r�rMrVr�r�rr�ry)rrOr�rPr�r�r��
update_allr�r�r�r��will_update�will_update_from_other_packagerQr'rgr��
nothing_to_dor��pkgnamer�r��	to_update�w�	other_pkgr�r��	out_lowers                             r!�latestzYumModule.latest s^
������I����E�
���I����D�	�����X����Y�����	��
���q�q�q�!���%�<�<��J��,�,�.�.���C��
��7�7�z�7��	�N�!�!�"S�T�T�T��J�
�3�Y�Y�!%�!8�!8��!=�!=��G�Y�Y�
�1�W�W��C��J��C��I�!�D�K�!�(�(�C�(�(�(��d	1��J�J�x� � � ��g�l�l�n�n�-�-�K�-1�V�V�*�*��%�%�K�-1�V�V�*��]
1�]
1���?�?�3�'�'����N�)�)�$�/�/�/��O�O�D�)�)�)���=�=��(�(��U�$�->�->��7�>�>�$�/�/�5��E�
�
�
�&Q�TX�&X�X�
�
�
��I��-�-�.Y�\`�.`�a�a�a�$'��D�	�-���-�4�4��4�4�4�!�,�,�T�2�2�E��}���-�-�2h�ko�2o�-�p�p�p��(�(���6�6�5��X��-�-�d�3�3�3�3��Y��.�.�t�4�4�4���D�=�=��+�+�-�-�@�@�",�T�[�$�"?�"?��@�@�@�@�@�@�@�@�@�@�@����@�@�@�@� �,�,�W�5�5�E��}���-�-�2h�ko�2o�-�p�p�p��(�(���6�6�5��X��-�-�d�3�3�3�3��Y��.�.�t�4�4�4���$�$�U�D�1�1�1���N�)�)�$�/�/�/�/���O�*�*�4�0�0�0��,�,�U�D�9�9���1���J�J�J�"b�ei�"i�i�J�J�J��	�N�)�)�*j�mq�*q�r�r�r� #�C��I�)�D�K�)�0�0�C�0�0�0� $�
�"���C��t�I��.�.�4�3D�3D�U�C�3P�3P�.�(-�
���
+8��*<�*<�'�G�Q��1�a��t�H�~�-�-�'�W�2D�2D�(-�
�#����-�-�-��7�?�?�DK�:�4�@�����(�(���5�5��$�:J���	�N�)�)�*l�os�*s�t�t�t�� ���	�N�)�)�*T�W[�*[�\�\�\��!�3�3�G�<�<�	��1���J�J�J�"X�[_�[d�[d�en�[o�[o�"o�o�J�J�J��	�N�)�)�*`�cg�cl�cl�mv�cw�cw�*w�x�x�x� #�C��I�)�D�K�)�0�0�C�0�0�0���	��;	�;	�A��|�|�C� � �:
�� � �!�T��+�+�+�+��'�!�!�;�1�=�	�*�i�(��+��� � ���%�I�I��	�N�N�N���K�K�K���K�K�	��
�
�
�
�#�1�:�
�
�C��$�$�� #�I���� #�F���� #�F�����	�	�	�	�
���	P�!�B�	�B�B�B�C�	�N�N�!�D��O�Y�O�O�O�C�	�N��	)�(�C����;�!�	��
&�d�9�o�
&�!%��I���J��?�	>��J�J�)�D�O�;�<�=�=�=��	'��;�2�2�3�7�7�L�B��S�!�C�	�N�N�
�
�	'��H�~�

+���z�D��N�2�2��1�$�+�>�>���V�F��O�O�O��#�{�6�6�s�8�6�T�T���C���I�I�K�K�-�-�/�/�	� �)�)�*I�J�J�*�%�.�.��?�?�*�%)�C�	�N��*�{�{���C���
�)�_�
	'��
	'�D�4D�
	'��I�;��i��0�4��>�A�A�C�-�d�k�:�:�F����F�K�K�K�H��;�2�2�3�x�2�P�P�L�B��S��	�	���)�)�+�+�I��%�%�&E�F�F�
&�!�*�*�?�;�;�
&�!%��I���&�;�;�L�B��S���D�	��E�
�
�
�c��
�
�
��I����c�"�"�"�
�	!� �C��M��
s�J)�)J-	�0J-	c�(
�|j}|js|jr	g}d|_|jrItj�|j��r%|xjd|jgz
c_|r|d|jgz
}|jr|j�	dg��|j
r6|j�	dd�|j
��zg��|jr6|j�	dd�|j��zg��|j
r4|j�	dd�|j
��g��|jr4|j�	dd�|j��g��|jr8d	d�|j��zg}|j�	|��|jr#|j�	d
|jzg��|jr|j�	dg��|jrE|j�	dg��|jr#|j�	d
|jzg��|jr#|j�	d|jzg��|jdkr%d|jzg}|j�	|��|jdv�rK	|jr$|j�|jddgz��	|jjj���}|jr�	|jjj���}|D]1}||vr+|jj�|��}|jj}�2|}nL#t>j j!$r5}	|j�"dtG|	��z���Yd}	~	nd}	~	wwxYwnL#t>j j!$r5}	|j�"dtG|	��z���Yd}	~	nd}	~	wwxYw|jdks|j$rz|j%r|j�&d��|j'r|j�&d��|j(r|j�&d��|�)||��}
n|jdvr8|j%r|j�&d��|�*||��}
n>|jdvr|�+||��}
n|j�"dddd �!��|
S)"N�absentr8z
--skip-brokenz--disablerepo=%sr�z--enablerepo=%sz--enablepluginz--disablepluginz--exclude=%sz--disableexcludes=%sz--cacheonlyz--downloadonlyz--downloaddir=%sr�rJz--installroot=%s)r(�presentr��clean�expire-cachez!Error setting/accessing repos: %sr%zError accessing repos: %sr�z--nogpgcheckz
--securityz--bugfix)r(r�)r�r�z/we should never get here unless this all failedFr�zunexpected state)r&rJrH�errors),�namesr�r@rZr<r[r\r��skip_brokenr�rer�r(rRrT�excluderc�	cacheonly�
download_only�download_dirrVrW�update_cacherr�r)r*r��getRepo�repoXMLr?rr,r-r.r
r��disable_gpg_checkr��security�bugfixr�r`r�)rr�r��e_cmd�
current_repos�	new_repos�ir1r�r0rPs           r!�ensurezYumModule.ensures����z���z�	"�d�o�	"��D�!�D�J��>�	0�b�g�n�n�T�^�<�<�	0�����t�~� 6�6����
0��$���/�/����	7���#�#�_�$5�6�6�6���	W���#�#�%7�#�(�(�4�CS�:T�:T�%T�$U�V�V�V��?�	U���#�#�%6����$�/�9R�9R�%R�$S�T�T�T���	V���#�#�%5�s�x�x��@R�7S�7S�$T�U�U�U���	X���#�#�%6�����AT�8U�8U�$V�W�W�W��<�	+�#�c�h�h�t�|�&<�&<�<�=�E���#�#�E�*�*�*�� �	V���#�#�%;�d�>S�%S�$T�U�U�U��>�	5���#�#�]�O�4�4�4���	R���#�#�%5�$6�7�7�7�� �
R�� �'�'�);�d�>O�)O�(P�Q�Q�Q��?�	K���#�#�%6���%H�$I�J�J�J���s�"�"�(�$�*:�:�;�E���#�#�E�*�*�*��:�;�;�;�
�2� �
V���'�'��(8�G�^�;T�(T�U�U�U�

V� $�
� 3� 9� >� >� @� @�
��?�	f�f�$(�M�$7�$=�$B�$B�$D�$D�	�!*�7�7�A� �
�5�5�&*�m�&9�&A�&A�!�&D�&D��$'�K�$6���(1�
�
���:�2�f�f�f���-�-�2U�Xa�bc�Xd�Xd�2d�-�e�e�e�e�e�e�e�e�����f�������:�*�
V�
V�
V���%�%�*E�	�RS���*T�%�U�U�U�U�U�U�U�U�����
V�����:��!�!�T�%5�!��%�
8�� �'�'��7�7�7��}�
6�� �'�'��5�5�5��{�
4�� �'�'�
�3�3�3��+�+�d�E�*�*�C�C�
�Z�3�
3�
3��%�
8�� �'�'��7�7�7��,�,�t�U�+�+�C�C�
�Z�0�
0�
0��+�+�d�E�*�*�C�C�
�K�!�!�E���)�	
"�
�
�
��
sC�)*N;�AM.�-N;�.N7�+N2�-N;�2N7�7N;�;P�+O?�?Pc��tSr�)�HAS_YUM_PYTHONr�r"r!�has_yumzYumModule.has_yum�s���r"c��trts-tjdkrt	��std��g}ts|�d��ts|�d��|���|r.|j�	d�
|�����|j�d��r|j�d��}n|j�d��}|dd	d
g|_|j
rz|jss|jsl|j�|jddgz��\}}}|d
kr|j�dd|g���n|j�dd||g���|j�dd���}|jr�|s�|jjs�|j�d��}|rI|jr%|j�|�d|j����n|j�d|z��|j�dd���}|jr<|s|j�	d���d|�||j��i}�n�d}		|jjj}
d|
v�rF|�rC|dddg}	|jdkr|	�d|jg��|j�r	t9dd ��5}|���}ddd��n#1swxYwYt=j|jj d�!��}
|j�!|
j"��|
�#d"�|D����|
�$��nB#tJ$r5}|j�	d#tM|��z���Yd}~nd}~wwxYw|	�d$|
j"g��n#tN$rYnwxYw|�(|	��}|	r|�)d%d&���d'd(��|d%<|jjd)i|��dS)*z:
        actually execute the module code backend
        z/usr/bin/pythonzThe Python 2 bindings for rpm are needed for this module. If you require Python 3 support use the `dnf` Ansible module instead.zxThe Python 2 yum module is needed for this module. If you require Python 3 support use the `dnf` Ansible module instead.z. r%zyum-deprecatedrz-d�2z-yr�r�rFz
Cache updated)rJr&r�rHzFailed to update cache�	repoqueryr�z# -y install yum-utils --releasever z%s -y install yum-utilszZrepoquery is required to use list= with this module. Please install the yum-utils package.rHN�	rhnpluginr4r5r6rJr7z
/etc/yum.confr4)�dir�deletec�<�g|]}|�d���|��S)zexclude=)rc)r��cs  r!r�z!YumModule.run.<locals>.<listcomp>�s-��9m�9m�9m��TU�T`�T`�ak�Tl�Tl�9m�!�9m�9m�9mr"z Failure setting up repoquery: %sr8r&r�� zxWarning: Due to potential bad behaviour with rhnplugin and certificates, used slower repoquery calls instead of Yum API.r�)*�HAS_RPM_PYTHONr��sys�
executablerr	r��
wait_for_lockrr.r�r�r�r�r�r�r�rN�install_repoqueryrMrVrFr)rQ�_pluginsrWr�rcr8�	readlines�tempfile�NamedTemporaryFile�tmpdir�add_cleanup_filero�
writelinesrrgr
�AttributeErrorr��get)r�
error_msgs�yumbinr��stdout�stderrrC�yum_pathrHr��yum_pluginsrE�content�
tmp_conf_filer0s               r!�runz
YumModule.run�s_��
�	.�n�	.�#�.�L]�:]�:]�fs�fu�fu�:]��,�-�-�-��
��	a����`�
a�
a�
a��	Z����Y�
Z�
Z�
Z��������	=��K�!�!�d�i�i�
�&;�&;�!�<�<�<�
�;�#�#�$4�5�5�	5��[�-�-�.>�?�?�F�F��[�-�-�e�4�4�F�#�D�#�t�4�����	�T�Z�	��	�	�!%��!8�!8��9I�W�Vd�Le�9e�!f�!f��B����Q�w�w���%�%�!�'���	&�������%�%�!�0��#�H�	&�����{�/�/��e�/�L�L���!�	Q�,�	Q�t�{�?U�	Q��{�/�/��6�6�H��
R��?�R��K�+�+�Ya�Ya�Ya�cg�cr�cr�,s�t�t�t�t��K�+�+�,E��,P�Q�Q�Q��;�3�3�K�%�3�P�P�L��9�+	��
H���%�%�+G�%�H�H�H� �$�/�/�,��	�"J�"J�K�G�G��I�
I�"�m�3�<���+�-�-�#�I�%1�3F��U^�$_�	��+�s�2�2�%�,�,�o�t�?O�-P�Q�Q�Q��0�I�
m�%)�/�3�%?�%?�!<�1�./�k�k�m�m�G�!<�!<�!<�!<�!<�!<�!<�!<�!<�!<�!<����!<�!<�!<�!<�19�0K�PT�P[�Pb�kp�0q�0q�0q�
� $�� <� <�]�=O� P� P� P� -� 8� 8�9m�9m�W�9m�9m�9m� n� n� n� -� 3� 3� 5� 5� 5� 5��#,�m�m�m� $�� 5� 5�:\�_h�ij�_k�_k�:k� 5� l� l� l� l� l� l� l� l�����m����&�,�,�d�M�4F�-G�H�H�H���1"�
�
�
���
����4�k�k�)�,�,�G��
��K�K��r�*�*�*�*�O�O�"����
	����(�(��(�(�(�(�(sO�
O*�N�,L
�N�
L�N�L�A5N�
O
�+O�O
�*
O7�6O7)NF)r/)"�__name__�
__module__�__qualname__�__doc__rr2rH�propertyr)rtr�r��def_qfr�r�r�r�r
rr!r.r2rFrRr`r�r��staticmethodr�r�r�r�r��
__classcell__)r s@r!rr�s'��������������( � � �((�(�(�T�1�1��X�1�fW�W�W����.4�4�4�4�l/5�!�!�!�!�F,2�'�'�'�'�R17�;�;�;�;�z#�#�#�J
�
�
�*�&=�&=��^�&=�P���.����
�
�
�B4�4�4�lk�k�k�ZA�A�A�F����+"�+"��\�+"�Zx�x�x�tx�x�x�t����\��h)�h)�h)�h)�h)�h)�h)r"rc��tdgd����tdd<tdit��}t|��}|���dS)N�auto)r�r�yum4�dnf)�default�choices�
argument_spec�use_backendr�)r�rrrr�)r�module_implementations  r!�mainr�sm��<@��Xv�Xv�Xv�;w�;w�;w���)�-�8�
���
���F�&�f�-�-���������r"�__main__)0�
__future__rrr�type�
__metaclass__�
DOCUMENTATION�EXAMPLES�ansible.module_utils.basicr�"ansible.module_utils.common.localer�#ansible.module_utils.common.respawnrr	�ansible.module_utils._textr
r�ansible.module_utils.urlsr�ansible.module_utils.yumdnfr
rrCr<rr�r�r�r��ImportErrorrr��yum.miscrr�rpmUtils.miscutilsrrr��
contextlibrrr�r�rr�r�r�r"r!�<module>rsW��A�@�@�@�@�@�@�@�@�@��
�a�
�F	_��B5�4�4�4�4�4�G�G�G�G�G�G�M�M�M�M�M�M�M�M�9�9�9�9�9�9�9�9�/�/�/�/�/�/�D�D�D�D�D�D�D�D�����	�	�	�	�	�	�	�	�
�
�
�
�������J�J�J��N�N�������N�N�N�������J�J�J��N�N�������N�N�N����� �H�H�H�H�H�H�H�H�<�<�<�<�<�<�<�<������ � � ����� ����&�%�%�%�%�%�0�0�0�0�0�0�	9��	
��H)�H)�H)�H)�H)��H)�H)�H)�V* � � �,�z����D�F�F�F�F�F��s6�A�A!� A!�%A,�,A6�5A6�:B
�
B�B

Youez - 2016 - github.com/yon3zu
LinuXploit