관리-도구
편집 파일: dnf.cpython-39.opt-1.pyc
a �����)g������������������������@���s����d�dl�mZmZmZ�eZdZdZd�dlZd�dl Z d�dl Z d�dlmZm Z �d�dlmZ�d�dlmZmZ�d�dlmZ�d�d lmZ�d�d lmZ�d�dlmZmZmZ�d�dlmZmZ�da G�d d��de�Z!dd��Z"e#dkr�e"���dS�)�����)�absolute_import�division�print_functiona&�� --- module: dnf version_added: 1.9 short_description: Manages packages with the I(dnf) package manager description: - Installs, upgrade, removes, and lists packages and groups with the I(dnf) package manager. options: name: description: - "A package name or package specifier with version, like C(name-1.0). When using state=latest, this can be '*' which means run: dnf -y update. You can also pass a url or a local path to a rpm file. To operate on several packages this can accept a comma separated string of packages or a list of packages." - Comparison operators for package version are valid here C(>), C(<), C(>=), C(<=). Example - C(name >= 1.0). Spaces around the operator are required. - You can also pass an absolute path for a binary which is provided by the package to install. See examples for more information. required: true aliases: - pkg type: list elements: str list: description: - Various (non-idempotent) commands for usage with C(/usr/bin/ansible) and I(not) playbooks. Use M(ansible.builtin.package_facts) instead of the C(list) argument as a best practice. type: str state: description: - Whether to install (C(present), C(latest)), or remove (C(absent)) a 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. choices: ['absent', 'present', 'installed', 'removed', 'latest'] type: str 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 ",". type: list elements: str 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 ",". type: list elements: str conf_file: description: - The remote dnf configuration file to use for the transaction. type: str 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). - This setting affects packages installed from a repository as well as "local" packages installed from the filesystem or a URL. type: bool default: 'no' installroot: description: - Specifies an alternative installroot, relative to which all packages will be installed. version_added: "2.3" default: "/" type: str releasever: description: - Specifies an alternative release from which all packages will be installed. version_added: "2.6" type: str 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) type: bool default: "no" version_added: "2.4" exclude: description: - Package name(s) to exclude when state=present, or latest. This can be a list or a comma separated string. version_added: "2.7" type: list elements: str 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.7" update_cache: description: - Force dnf 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: "2.7" 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.7" security: description: - If set to C(true), and C(state=latest) then only installs updates that have been marked security related. - Note that, similar to C(dnf upgrade-minimal), this filter applies to dependencies as well. type: bool default: "no" version_added: "2.7" bugfix: description: - If set to C(true), and C(state=latest) then only installs updates that have been marked bugfix related. - Note that, similar to C(dnf upgrade-minimal), this filter applies to dependencies as well. default: "no" type: bool version_added: "2.7" enable_plugin: description: - I(Plugin) name to enable for the install/update operation. The enabled plugin will not persist beyond the transaction. version_added: "2.7" type: list elements: str disable_plugin: description: - I(Plugin) name to disable for the install/update operation. The disabled plugins will not persist beyond the transaction. version_added: "2.7" type: list elements: str disable_excludes: description: - Disable the excludes defined in DNF config files. - If set to C(all), disables all excludes. - If set to C(main), disable excludes defined in [main] in dnf.conf. - If set to C(repoid), disable excludes defined for given repo id. version_added: "2.7" type: str 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. type: bool default: "yes" version_added: "2.7" 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" 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.7" install_repoquery: description: - This is effectively a no-op in DNF as it is not needed with DNF, but is an accepted parameter for feature parity/compatibility with the I(yum) module. type: bool default: "yes" 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 dnf 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. 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" allowerasing: description: - If C(true) it allows erasing of installed packages to resolve dependencies. required: false type: bool default: "no" version_added: "2.10" nobest: description: - Set best option to False, so that transactions are not limited to best candidates only. required: false type: bool default: "no" version_added: "2.11" cacheonly: description: - Tells dnf to run entirely from system cache; does not download or update metadata. type: bool default: "no" version_added: "2.12" extends_documentation_fragment: - action_common_attributes - action_common_attributes.flow attributes: action: details: In the case of dnf, 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. - Group removal doesn't work if the group was installed with Ansible because upstream dnf's API doesn't properly mark groups as installed, therefore upon removal the module is unable to detect that the group is installed (https://bugzilla.redhat.com/show_bug.cgi?id=1620324) requirements: - "python >= 2.6" - python-dnf - for the autoremove option you need dnf >= 2.0.1" author: - Igor Gnatenko (@ignatenkobrain) <i.gnatenko.brain@gmail.com> - Cristian van Ee (@DJMuggs) <cristian at cvee.org> - Berend De Schouwer (@berenddeschouwer) - Adam Miller (@maxamillion) <admiller@redhat.com> aR�� - name: Install the latest version of Apache ansible.builtin.dnf: name: httpd state: latest - name: Install Apache >= 2.4 ansible.builtin.dnf: name: httpd >= 2.4 state: present - name: Install the latest version of Apache and MariaDB ansible.builtin.dnf: name: - httpd - mariadb-server state: latest - name: Remove the Apache package ansible.builtin.dnf: name: httpd state: absent - name: Install the latest version of Apache from the testing repo ansible.builtin.dnf: name: httpd enablerepo: testing state: present - name: Upgrade all packages ansible.builtin.dnf: name: "*" state: latest - name: Update the webserver, depending on which is installed on the system. Do not install the other one ansible.builtin.dnf: name: - httpd - nginx state: latest update_only: yes - name: Install the nginx rpm from a remote repo ansible.builtin.dnf: 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.dnf: name: /usr/local/src/nginx-release-centos-6-0.el6.ngx.noarch.rpm state: present - name: Install Package based upon the file it provides ansible.builtin.dnf: name: /usr/bin/cowsay state: present - name: Install the 'Development tools' package group ansible.builtin.dnf: name: '@Development tools' state: present - name: Autoremove unneeded packages installed as dependencies ansible.builtin.dnf: autoremove: yes - name: Uninstall httpd but keep its dependencies ansible.builtin.dnf: name: httpd state: absent autoremove: no - name: Install a modularity appstream with defined stream and profile ansible.builtin.dnf: name: '@postgresql:9.6/client' state: present - name: Install a modularity appstream with defined stream ansible.builtin.dnf: name: '@postgresql:9.6' state: present - name: Install a modularity appstream with defined profile ansible.builtin.dnf: name: '@postgresql/client' state: present N)� to_native�to_text)� fetch_file)�PY2� text_type)�LooseVersion)� AnsibleModule)�get_best_parsable_locale)� has_respawned�probe_interpreters_for_module�respawn_module)�YumDnf�yumdnf_argument_specc�����������������������s����e�Zd�ZdZ��fdd�Zdd��Zdd��Zdd ��Zd d��Zdd ��Z dd��Z dd��Zdd��Zd3dd�Z dd��Zdd��Zdd��Zdd��Zd d!��Zd4d#d$�Zd%d&��Zd'd(��Zd)d*��Zd+d,��Zd-d.��Zd/d0��Zd1d2��Z���ZS�)5� DnfModulez4 DNF Ansible module back-end implementation c��������������������sl���t�t|���|��|�����d|�_d|�_ztjj|�_ W�n�t yJ���d|�_ Y�n0�|�jjd�|�_ |�jjd�|�_d�S�)Nz/var/cache/dnf/*_lock.pid�dnfF�allowerasing�nobest)�superr����__init__�_ensure_dnfZlockfileZpkg_mgr_namer����baseZWITH_MODULES�with_modules�AttributeError�module�paramsr���r���)�selfr����� __class__���7/usr/lib/python3.9/site-packages/ansible/modules/dnf.pyr������s����zDnfModule.__init__c�����������������C���s���dS�)NTr!����r���r!���r!���r"����is_lockfile_pid_valid���s����zDnfModule.is_lockfile_pid_validc�����������������C���s.���t�d�t�|�v�s t�d�t�|�v�r*d�|�S�|S�)z� For unhandled dnf.exceptions.Error scenarios, there are certain error messages we want to filter in an install scenario. Do that here. �no package matched�No match for argument:�No package {0} available.)r����format�r����spec�errorr!���r!���r"����_sanitize_dnf_error_msg_install���s������ z)DnfModule._sanitize_dnf_error_msg_installc�����������������C���s.���dt�|�v�sdt�|�v�r&dd�|�fS�d|fS�)z� For unhandled dnf.exceptions.Error scenarios, there are certain error messages we want to ignore in a removal scenario as known benign failures. Do that here. r%���r&���Fz{0} is not installedT)r���r(���r)���r!���r!���r"����_sanitize_dnf_error_msg_remove���s���� � �z(DnfModule._sanitize_dnf_error_msg_removec�����������������C���sb���|j�|jt|j�|j|j|jd�}djf�i�|��|d<�|d�|d<�|jdkrVd|d<�nd|d<�|S�) z3Return a dictionary of information for the package.)�name�arch�epoch�release�version�repoz){epoch}:{name}-{version}-{release}.{arch}Zenvra�nevrar���� availableZyumstate� installed) r.���r/����strr0���r1���r2����repoidr(���Zinstalltime)r����package�resultr!���r!���r"���� _package_dict���s����� zDnfModule._package_dictc�����������������C���s8���g�d�}|��d�\}}}|r0|r0||v�r0||fS�|d�fS�)N)@Zaarch64Z alphaev56Zalphaev5Z alphaev67Zalphaev6ZalphaZ alphapca56Zamd64Zarmv3lZarmv4bZarmv4lZ armv5tejlZarmv5telZarmv5tlZarmv6hlZarmv6lZarmv7hlZarmv7hnlZarmv7lZathlonZgeodeZi386Zi486Zi586Zi686Zia32eZia64Zm68kZmips64elZmips64Z mips64r6elZmips64r6ZmipselZmipsZmipsr6elZmipsr6ZnoarchZpentium3Zpentium4Zppc32dy4Zppc64iseriesZppc64leZppc64Zppc64p7Zppc64pseriesZppc8260Zppc8560Z ppciseriesZppcZ ppcpseriesZriscv64Zs390Zs390xZsh3Zsh4aZsh4�shZsparc64Zsparc64vZsparcZsparcv8Zsparcv9Zsparcv9vZx86_64�.)� rpartition)r����packagenameZredhat_rpm_archesr.���Z delimiterr/���r!���r!���r"����_split_package_arch���s ����zDnfModule._split_package_archc����������� ��� ���C���s��|dd��dkr|dd��}t��d�}zfd}|��|�\}}|rB|}|�|�}|r�|�|����\}}}} |r||�d�d����s�W�dS�nW�dS�W�nB�ty��} �z*|�jj d|t | �f�dg�d ��W�Y�d} ~ n d} ~ 0�0�|s�d }d|v��r|�d�}|d�}d�|dd���}||| |d �}|S�)z� Return a dictionary of information for a package name string or None if the package name doesn't contain at least all NVR elements ���N�.rpmz$(\S+)-(?:(\d*):)?(.*)-(~?\w+[\w.+]*)r=���r���z)Error attempting to parse package: %s, %s����)�msg�rc�results�0�:��)r.���r0���r1���r2���)�re�compiler@����match�groups�split�isdigitr���r���� fail_jsonr����join) r���r?���Zrpm_nevr_rer/���ZnevrZrpm_nevr_matchr.���r0���r2���r1����eZ epoch_namer:���r!���r!���r"����_packagename_dict���s@���� � �zDnfModule._packagename_dictc�����������������C���sl���|d�u�rd}nt�|�}t�|�}t�|�}|d�u�r4d}nt�|�}t�|�}t�|�}tjj�|||f|||f�}|S�)NrG���)r7���r���ZrpmZlabelCompare)r����e1Zv1Zr1�e2Zv2Zr2rE���r!���r!���r"����_compare_evr��s����zDnfModule._compare_evrc�����������������C���s����t�|�j�}|�tjd<�tjd<�|�tjd<�tjd<�z8dd�ladd�ladd�ladd�ladd�ladd�l ad}W�n�t y����d}Y�n0�|r�d�S�g�d�}t��s�t|d �}|r�t |��|�jjd �tjtj�dd�|�g�d ��d�S�)N�LC_ALL�LC_MESSAGES�LANGUAGE�LANGr���TF)z/usr/libexec/platform-pythonz/usr/bin/python3z/usr/bin/python2z/usr/bin/pythonr���z�Could not import the dnf python module using {0} ({1}). Please install `python3-dnf` or `python2-dnf` package or ensure you have specified the correct ansible_python_interpreter. (attempted {2})� rI����rD���rF���)r���r����os�environr���Zdnf.cliZ dnf.constZdnf.exceptionsZdnf.subjectZdnf.util�ImportErrorr ���r���r���rP���r(����sys� executabler2����replace)r����localeZHAS_DNFZsystem_interpretersZinterpreterr!���r!���r"���r���2��s4���� ��zDnfModule._ensure_dnf�/Tc����������� ������C���sT��|j�}|r2t�|tj�s,|�jjd|g�d��n||_|����d|_|�|_ |�|_ d|_||_||_ |j�|��|�jr�t|j�}|�|�j��||_|�jr�t|j�}|�j|vr�|�|�j��||_|�jdur�|�j|jd<�|j�d�du�r�|�j�d��d|jd<�|�j�rd|_|�j�rd|_|�j�r2d|_|�j�r2|�j|_|�j �r@d|_ |�j!|_"|�j#|_#dS�) zConfigure the dnf Base object.zcannot read configuration file)rD���� conf_filerF���r���TN� releaseverzUUnable to detect release version (use "releasever" option to specify release version)rI���)$�confr]����access�R_OKr���rP���Zconfig_file_path�readZ debuglevelZgpgcheckZlocalpkg_gpgcheckZ assumeyes� sslverify�installrootZ substitutionsZupdate_from_etcZexclude�list�extendZdisable_excludes�appendrf����get�warnZskip_broken�strictr����best� download_onlyZdownloadonly�download_dir�destdirZ cacheonly� autoremoveZclean_requirements_on_removeZinstall_weak_deps) r���r���re����disable_gpg_checkrl���rk���rg���Z _excludesZ_disable_excludesr!���r!���r"����_configure_base]��sX����� � zDnfModule._configure_basec�����������������C���s^���|�����|j}|D�] }|r|�|�D�]}|����q$q|D�] }|r8|�|�D�]}|����qJq8dS�)z?Enable and disable repositories matching the provided patterns.N)�read_all_repos�reposZget_matching�disable�enable)r���r����disablerepo� enablerepor{���Zrepo_patternr3���r!���r!���r"����_specify_repositories���s����zDnfModule._specify_repositoriesc�������������� ���C���s(��t����}|��|||||��z|����W�n�ty8���Y�n0�z$|�t|�j�t|�j���|� ���W�n�typ���Y�n0�|�� |||��z|����W�n�ty����Y�n0�zh|�jr�z|����W�nD�t�j jy��}�z(|�jjd�t|��g�dd��W�Y�d}~n d}~0�0�|jdd��W�nF�t�j j�yN�}�z(|�jjd�t|��g�dd��W�Y�d}~n d}~0�0�t|dd�} t| ��r�i�} |�j�r�| �dg���d ��|�j�r�| �dg���d ��| �r$| d i�| ���npg�} |�j�r�dd i}| �|j������jf�i�|����|�j�rdd i}| �|j������jf�i�|����| �r$| |_|S�)z*Return a fully configured dnf Base object.z{0}rC����rD���rF���rE���N�auto)Zload_system_repo�add_security_filters�types�bugfix�security�eqZadvisory_type__eq)r����)r���ZBasery���Z setup_loggersr���Zinit_plugins�setZdisable_pluginZ enable_pluginZpre_configure_pluginsr����Zconfigure_plugins�update_cache� exceptions� RepoErrorr���rP���r(���r���Z fill_sack�getattr�callabler����� setdefaultro���r�����sack�query�upgrades�filterZ_update_security_filters)r���re���rx���r~���r���rl���rk���r���rR���r�����filters�keyr!���r!���r"����_base���sh������ zDnfModule._basec��������������������s����|dkrd}|dv�r8��fdd�t���jj���|���D��}nH|dv�rXdd����jj���D��}n(tj�|�� ��jj�}��fdd�|D��}��j jd |d ��dS�)z'List package info based on the command.Zupdatesr����)r6���r����r5���c��������������������s���g�|�]}����|��qS�r!����r;�����.0r9���r#���r!���r"���� <listcomp>��s����z(DnfModule.list_items.<locals>.<listcomp>)r{���Zrepositoriesc�����������������S���s���g�|�]}|j�d�d��qS�)Zenabled)r8����state)�id)r����r3���r!���r!���r"���r������s����c��������������������s���g�|�]}����|��qS�r!���r����r����r#���r!���r"���r�����������rI���r\���N)r����r���r����r����r{���Ziter_enabledr����subject�Subject�get_best_queryr���� exit_json)r���ZcommandrF���Zpackagesr!���r#���r"���� list_items��s���� � �zDnfModule.list_itemsc�����������������C���st���|�j�j������}i�}|��|�\}}|r.||d<�|��|�}|rXt|d��|d<�|�|��n||d<�t|j f�i�|���S�)Nr/���r0���r.���) r���r����r����r6���r@���rS����int�update�boolr����)r����pkgr6���Zpackage_specr.���r/���Zpackage_detailsr!���r!���r"���� _is_installed��s���� zDnfModule._is_installedc�������������� ���C���sx���|���|�}|sdS�|�jj������}|j|d�d����}|rp|d�}|��|j|j |j |d�|d�|d��}|dkS�dS�d�S�) NFr.���)r.���r���r0���r2���r1���rC���)rS���r���r����r����r6���r�����runrV���r0���r2���r1���)r����pkg_nameZ candidate_pkgr6���� installed_pkgZevr_cmpr!���r!���r"����_is_newer_version_installed0��s���� �z%DnfModule._is_newer_version_installedFc�������������� ���C���s���|���|�}|��|�}z�|rh|�jr�|rN|r6|�j�|��qd|�jj||�jjjd��qf|�jj||�jjjd��q�n.|r�|r�|�j�|��q�n|�jj||�jjjd��ddddd�W�S��tj j ��y��}�z0dd�|�d�|t |�f�d g�d �W��Y�d}~S�d}~0��tj j�y>�}�z0dd�|�d�|t |�f�d g�d �W��Y�d}~S�d}~0��tj j�y��}�zftd �t|�v��r|dddd�W��Y�d}~S�dd�|�d�|t |�f�d g�d �W��Y�d}~S�W�Y�d}~n d}~0�0�dS�)zMark the package for install.�rr���FrI���r���)�failedrD����failurerE���Tr'���� rC���)r����rD���r����rE���rF���Nz(Depsolve Error occurred for package {0}.�already installed)r����rD���r����z'Unknown Error occurred for package {0}.)r����r�����allow_downgrader����upgrade�installrg���rr���r���r�����MarkingErrorr(���rQ���r���� DepsolveError�Errorr���)r����pkg_specr����Zis_newer_version_installedZis_installedrR���r!���r!���r"����_mark_package_installF��sP���� ���zDnfModule._mark_package_installc�����������������C���sN���|�j�����|�j�j������}|j|d�}|�|j|d�����}|rJ|d�jS�d�S�)N)�file)Zprovidesr���) r���rz���r����r����r5���r�����unionr����r.���)r����filepathr5���Zfiles_filterr����r!���r!���r"���� _whatprovides���s���� zDnfModule._whatprovidesc����������� ������C���s��g�g�g�g�f\}}}}d}|�j�D�]�}d|v�rBt|�j|�}|�|��q|�d�rX|�|��q|�d�r~|��|�}|r�|�|��qq|�d�s�d|v�r�|s�|�j����d}|dd���� ��}|�j r�|�j�|�} | d�r�|�|��q�|�|��q�|�|��q|�|��q||||fS�) NFz://rB���rd����@TrC���r���) �namesr���r���ro����endswith� startswithr����r���Z read_comps�stripr����module_base�_get_modules) r���� pkg_specsZ grp_specs�module_specs� filenamesZalready_loaded_compsr.���r����Zgrp_env_mdl_candidateZmdlr!���r!���r"����_parse_spec_group_file���s4���� z DnfModule._parse_spec_group_filec�����������������C���s����g�}|D�]�}|���|�r�z,tt|�t�r4|�j�|��n|�j�|��W�q��ty��}�z(|�jj d� t|��g�dd��W�Y�d�}~q�d�}~0�0�q|�|��q|S�)Nz4Error occurred attempting update_only operation: {0}rC���r����) r����� isinstancer���r ���r���r����Zpackage_upgrade� Exceptionr���rP���r(���r���ro���)r����pkgs� not_installedr����rR���r!���r!���r"����_update_only���s���� �zDnfModule._update_onlyc�����������������C���s^��t�tj�d�d��dkr6tt|�j�t|��dd��}nxg�}z |D�]}|�|�j� |���q@W�nR�t y��}�z:td�t|�v�r�|�jj d�|t|��g�dd ��W�Y�d�}~n d�}~0�0�|�jr�|��|��n�|D�]�}zL|��|��|�d ��r�|�jr�|�jj||�jjjd��n|�jj||�jjjd��W�q��t�yV�}�z(|�jj d�t|��g�dd ��W�Y�d�}~q�d�}~0�0�q�d�S�) Nr=���r�������T)�reversezCan not load RPM filezAError occurred attempting remote rpm install of package: {0}. {1}rC���r����r4���r����z3Error occurred attempting remote rpm operation: {0})r����r����__version__rN���rm����sortedr���Zadd_remote_rpmsro���Zadd_remote_rpm�IOErrorr���r���rP���r(���r����update_onlyr����r����r;���r����Zpackage_installrg���rr���r����)r���r����r�����filenamerR���r����r!���r!���r"����_install_remote_rpms���s6������zDnfModule._install_remote_rpmsc�����������������C���sT���|�j�rP|���}|�j�|�\}}|�jj�|j�}|rP|jrL|j|v�rFdS�dS�ndS�dS�)NTF) r���r����r����r����r���Z_moduleContainerZgetEnabledStreamr.����stream)r���Zmodule_specZmodule_listZnsvZenabled_streamsr!���r!���r"����_is_module_installed���s���� zDnfModule._is_module_installedc�����������!������C���s� ��ddg�dd�}dg�g�dd�}|�j�s4|�jr4g�|�_�d|�_|�j�dgkr�|�jd kr�z|�j����W�nB�tjjy��}�z&d |d<�|�jj f�i�|���W�Y�d�}~n d�}~0�0�� n^|�� ��\}}}}dd ��|D��}dd ��|D��}g�}g�} dd��|D��D�]^} |�jj�| �}|�r|� |j��q�|�jj�| �}|�r*| � |j��q�|�jj d�| �g�d��q�|�jdv��r�|��|��|D�]} |d�� d�| ����q\|�r|�j�r|D�]�}z@|��|��s�|d�� d�|���|�j�|g��|�j�|g��W�nF�tjj�y�}�z(|d�� d�|t|�f���W�Y�d�}~n d�}~0�0��q�|D�]�}zJ|�j�|tjj�}|dk�rV|d�� d�|���n|d�� d�|���W�n��tjj�y��}�z,d�|�|d<�|�jj f�i�|���W�Y�d�}~nNd�}~0��tjj�y��}�z(|d�� d�|t|�f���W�Y�d�}~n d�}~0�0��q| D�]�}z|�j�|tjj��W�n��tjj�yh�}�z,d�|�|d<�|�jj f�i�|���W�Y�d�}~nNd�}~0��tjj�y��}�z(|d�� d�|t|�f���W�Y�d�}~n d�}~0�0��q|�r�|�j�s�|�jj d�|d��g�d��|�j�r|�� |�}|D�]}|d�� d|����q�nv|D�]p}|��!|�}|d��rb|d��rF|d��|d�7��<�|d�� |��"||d����n|d��r|d�� |d����q�nx|�jd k�r�|��|��|D�]} |d�� d�| ����q�|�rP|�j�rP|D�]�}z2|��|��r�|d�� d �|���|�j�#|g��W�nF�tjj�yJ�}�z(|d�� d�|t|�f���W�Y�d�}~n d�}~0�0��q�|D�]�}z�z$|�j�$|��|d�� d!�|���W�nf�tjj%�y����|�j�s�|�j�|tjj�}|dk�r�|d�� d�|���n|d�� d�|���Y�n0�W�nF�tjj�y.�}�z(|d�� d�|t|�f���W�Y�d�}~n d�}~0�0��qT| D�]�}z@z|�j�&|��W�n*�tjj%�yx���|�j�|tjj��Y�n0�W�n|�tjj�y��}�zd�|�|d<�W�Y�d�}~nNd�}~0��tjj�y��}�z(|d�� d�|t|�f���W�Y�d�}~n d�}~0�0��q8|�j�r0|�� |�}|D�]}|d�� d|����qn�|D�]�}|�j'�|�jj(_)|�j!|d"d#�}|d��r�|d��r||d��|d�7��<�|d�� |��"||d����n|d��r4|d�� |d����q4�nB|�r�|�jj d$g�d��|�r�|�j�r�|D�]�}zN|��|��r |d�� d%�|���|�j�*|g��|�j�+|g��|�j�,|g��W�nF�tjj�y|�}�z(|d�� d�|t|�f���W�Y�d�}~n d�}~0�0��q�|D�]B}z|�j�-|��W�n*�tjj%�y����Y�n�t.�y����Y�n0��q�| D�]0}z|�j�/|��W�n�tjj%�y����Y�n0��q�|�jj0�1���2��}|D�]�}d|v�� r�z|�j�*|��W�nn�tjj3� y��}�zP|��4|t|��\}}|� r~|d�� d&�|t|����n|d�� |��W�Y�d�}~n d�}~0�0�� qtj5�6|�j7|�jj0d'��2���8��}|D�]}|�j�*t9|���� qʐ qd"|�_:|�j� r�|�j�����z�|�jj;|�j:d(�� sV|d�� r8d)|d<�|�jj f�i�|���d*|d<�|�jj<f�i�|����n�d"|d+<�|�j=� rld,}nd-}|�jj>j?D�]}|d�� d.�||���� qz|�jj>j@D�]}|d�� d/�|���� q�|d�� r�d)|d<�|�jj f�i�|���|�jjA�rd0|d<�|�jj<f�i�|���zX|�j=�rJ|�jB�rJ|�jj(jC�rJtjD�E|�jj(jC��|�jj(jC|�jjF�G��_H|�j�I|�jj>j?��W�nD�tjjJ�y��}�z&|�jj d1�tK|��g�d��W�Y�d�}~n d�}~0�0�|�jL�sP|�jj>j?D�]�}d}|�j�M|�\}}|dk�rސq�nP|dk�r*z|�j�N|��W�n.�tjj�y&�}�zd"}W�Y�d�}~n d�}~0�0�nd"}|�r�d2�||�}|�j� |���q�|�j=�rl|�jj<f�i�|���nB|�j�O��}|d�u�r�|�jjP�Q|g�d�} | jR�r�|d�� | �S����|d��r�d)|d<�|�jj f�i�|���|�jj<f�i�|���W�n��tjj� y4�}�z0d3�t|��|d<�|�jj f�i�|���W�Y�d�}~n�d�}~0��tjj� y��}�zvtKd4�tK|�v�� r�d|d+<�|d�� d5�t|����|�jj<f�i�|���n$d6�t|��|d<�|�jj f�i�|���W�Y�d�}~n d�}~0�0�d�S�)7NrI���Fr����rD����changedrF���rE���rC���)rD����failuresrF���rE���Zabsent�*Zlatestz:Depsolve Error occurred attempting to upgrade all packagesrD���c�����������������S���s���g�|�]}|�����qS�r!����r����)r�����pr!���r!���r"���r���� ��r����z$DnfModule.ensure.<locals>.<listcomp>c�����������������S���s���g�|�]}|�����qS�r!���r����)r�����fr!���r!���r"���r����!��r����c�����������������s���s���|�]}|����V��qd�S�)Nr����)r�����gr!���r!���r"���� <genexpr>$��r����z#DnfModule.ensure.<locals>.<genexpr>zNo group {0} available.r\���)r6���ZpresentrF���z Installed {0}zModule {0} installed.r����r����zGroup {0} already installed.zGroup {0} installed.z8Depsolve Error occurred attempting to install group: {0}z>Depsolve Error occurred attempting to install environment: {0}z@Packages providing %s not installed due to update_only specifiedr����r����zModule {0} upgraded.zGroup {0} upgraded.T)r����z3Cannot remove paths -- please specify package name.zModule {0} removed.z {0} - {1})r����)Z allow_erasingz0Failed to install some of the specified packagesz Nothing to dor����Z DownloadedZ Installedz{0}: {1}zRemoved: {0}z@Check mode: No changes made, but would have if not in check modez Failed to download packages: {0}z-Failed to validate GPG signature for {0}: {1}zDepsolve Error occurred: {0}r����zPackage already installed: {0}zUnknown Error occurred: {0})Tr����rw���r����r���Zupgrade_allr���r����r����r���rP���r�����compsZgroup_by_patternro���r����Zenvironment_by_patternr(���r����r���r����r����r����r}���Z MarkingErrorsrQ���r���Z group_install�constZGROUP_PACKAGE_TYPESr����Zenvironment_installr����r����r����r,���r����Z group_upgradeZ CompsErrorZenvironment_upgrader���rg���rs����remover|����resetZgroup_remover���Zenvironment_remover����r����r6���r����r-���r����r����r����r����r7���r����resolver����rt����transactionZinstall_setZ remove_setZ check_moderu���rv����utilZ ensure_dirr{����allZpkgdirZdownload_packagesZ DownloadErrorr���rx���Z_sig_check_pkgZ_get_key_for_packageZdo_transaction�history�oldZreturn_code�output)!r���ZresponseZfailure_responserR���r����Zgroup_specsr����r����rM���ZenvironmentsZ group_spec�groupZenvironmentr����r���Zgroup_pkg_count_installedr����r*���r����Zinstall_resultr6���Z is_failureZhandled_remove_errorr����r����Zinstall_actionr9���ZfailZgpgresZgpgerrrD����tidr����r!���r!���r"����ensure���s����� � ,� 6 &6&6� 6 6"6 �6 $� � &zDnfModule.ensurec�����������������C���sV��|�j�r.ttj�td�k�r.|�jjdtj�g�d��|�jr\ttj�td�k�r\|�jjdtj�g�d��|�jr�|�js�|�j s�|�� |�j|�j|�j |�j|�j|�j�|�_|�jjddg�dd ��|�jd u�r�d|�_|�j r�|�� |�j|�j|�j |�j|�j|�j�|�_|��|�j ��nh|�j�stj����s|�jjdg�d��|�� |�j|�j|�j |�j|�j|�j�|�_|�j�rJtjj�|�j�|�_|�����d S�) zThe main function.z2.0.1z9Autoremove requires dnf>=2.0.1. Current dnf version is %sr\���z2.6.2z;download_dir requires dnf>=2.6.2. Current dnf version is %sz Cache updatedFr���r����Nr6���z/This command has to be run under the root user.)rw���r ���r���r����r���rP���ru���r����r����rm���r����re���rx���r~���r���rl���rk���r���r����r����r����rt���r����Z am_i_rootr���r����Z ModuleBaser����r#���r!���r!���r"���r����\��sV�������� ���z DnfModule.run)rd���T)F)�__name__� __module__�__qualname__�__doc__r���r$���r,���r-���r;���r@���rS���rV���r���ry���r����r����r����r����r����r����r����r����r����r����r����r����r����� __classcell__r!���r!���r���r"���r������s4��� 1+ ]= F# ��_r���c��������������� ���C���s����t�ddd�td�d<�t�ddd�td�d<�tf�i�t��}�t|��}z|����W�nD�tjjy��}�z(|�jd� t |��dg�dd ��W�Y�d�}~n d�}~0�0�d�S�) NFr����)�default�typeZ argument_specr���r���z#Failed to synchronize repodata: {0}rC���)rD���rE���rF���r����)�dictr���r���r���r����r���r����r����rP���r(���r���)r���Zmodule_implementation�der!���r!���r"����main���s������r�����__main__)$Z __future__r���r���r���r����Z __metaclass__Z DOCUMENTATIONZEXAMPLESr]���rJ���r`���Zansible.module_utils._textr���r���Zansible.module_utils.urlsr���Zansible.module_utils.sixr���r ���Z#ansible.module_utils.compat.versionr ���Zansible.module_utils.basicr���Z"ansible.module_utils.common.localer���Z#ansible.module_utils.common.respawnr ���r���r���Zansible.module_utils.yumdnfr���r���r���r���r����r����r!���r!���r!���r"����<module> ���s:�����X��������!