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 : |
� ���c�! � � � d dl mZmZmZ eZdZdZdZd dl Z d dl Zd dlZd dl mZ d dlmZ d dlmZ d � Z G d � de� � Zd� Zed k r e� � dS dS )� )�absolute_import�division�print_functiona --- module: rpm_key author: - Hector Acosta (@hacosta) <hector.acosta@gazzang.com> short_description: Adds or removes a gpg key from the rpm db description: - Adds or removes (rpm --import) a gpg key to your rpm database. version_added: "1.3" options: key: description: - Key that will be modified. Can be a url, a file on the managed node, or a keyid if the key already exists in the database. type: str required: true state: description: - If the key will be imported or removed from the rpm db. type: str default: present choices: [ absent, present ] validate_certs: description: - If C(false) and the C(key) is a url starting with https, SSL certificates will not be validated. - This should only be used on personally controlled sites using self-signed certificates. type: bool default: 'yes' fingerprint: description: - The long-form fingerprint of the key being imported. - This will be used to verify the specified key. type: str version_added: 2.9 extends_documentation_fragment: - action_common_attributes attributes: check_mode: support: full diff_mode: support: none platform: platforms: rhel a - name: Import a key from a url ansible.builtin.rpm_key: state: present key: http://apt.sw.be/RPM-GPG-KEY.dag.txt - name: Import a key from a file ansible.builtin.rpm_key: state: present key: /path/to/key.gpg - name: Ensure a key is not present in the db ansible.builtin.rpm_key: state: absent key: DEADB33F - name: Verify the key, using a fingerprint, before import ansible.builtin.rpm_key: key: /path/to/RPM-GPG-KEY.dag.txt fingerprint: EBC6 E12C 62B1 C734 026B 2122 A20E 5214 6B8D 79E6 �#N)� AnsibleModule)� fetch_url)� to_nativec �~ � d}t t j |t | d�� � t j � � � � S )zVerifies if string is a pubkeyzP.*?(-----BEGIN PGP PUBLIC KEY BLOCK-----.*?-----END PGP PUBLIC KEY BLOCK-----).*�surrogate_or_strict)�errors)�bool�re�matchr �DOTALL)�string� pgp_regexs �</usr/lib/python3.11/site-packages/ansible/modules/rpm_key.py� is_pubkeyr [ s5 � �b�I�����I�f�=R�$S�$S�$S�UW�U^�_�_�`�`�`� c �J � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z d � Zd � ZdS )�RpmKeyc �R � d }d}|| _ | j � dd� � | _ |j d }|j d }|j d }|r(|� dd� � � � � }| j � d � � | _ | j s!| j � d d�� � | _ d|v r-| � |� � }| � |� � }d}nm| � |� � r|}nUt j � |� � r|}| � |� � }n| j � d |z �� � | � |� � }|dk r�| � |� � r|� d�� � d S |s| j � d�� � |r=| � |� � }||k r"| j � d|�d|�d��� � | � |� � |r| j � |� � |� d�� � d S | � |� � r-| � |� � |� d�� � d S |� d�� � d S )NF�rpmT�state�key�fingerprint� � �gpg�gpg2)�requiredz://zNot a valid key %s��msg�present)�changedz0When importing a key, a valid file must be givenzThe specified fingerprint, 'z'', does not match the key fingerprint '�')�module�get_bin_pathr �params�replace�upperr � fetch_key�getkeyid�is_keyid�os�path�isfile� fail_json�normalize_keyid�is_key_imported� exit_json�getfingerprint� import_key�cleanup�drop_key) �selfr'