관리-도구
편집 파일: unvault.cpython-39.pyc
a �)g� � @ sn d dl mZmZmZ eZdZdZdZd dl m Z d dlmZ d dl mZ d dlmZ e� ZG d d � d e�ZdS )� )�absolute_import�division�print_functiona� name: unvault author: Ansible Core Team version_added: "2.10" short_description: read vaulted file(s) contents description: - This lookup returns the contents from vaulted (or not) file(s) on the Ansible controller's file system. options: _terms: description: path(s) of files to read required: True notes: - This lookup does not understand 'globbing' nor shell environment variables. z� - ansible.builtin.debug: msg="the value of foo.txt is {{ lookup('ansible.builtin.unvault', '/etc/foo.txt') | string | trim }}" z_ _raw: description: - content of file(s) as bytes type: list elements: raw )�AnsibleParserError)� LookupBase)�to_text)�Displayc @ s e Zd Zddd�ZdS )�LookupModuleNc K s� g }| j ||d� |D ]�}t�d| � | �|d|�}t�d| � |r�| jj|dd�}t|d��}|�� } W d � n1 s�0 Y |� t | �� qtd| ��q|S ) N)Zvar_optionsZdirectzUnvault lookup term: %s�fileszUnvault lookup found %sT)Zdecrypt�rbz"Unable to find file matching "%s" )Zset_options�display�debugZfind_file_in_search_pathZvvvvZ_loaderZ get_real_file�open�read�appendr r ) �selfZtermsZ variables�kwargs�retZtermZ lookupfileZactual_file�fZ b_contents� r �B/usr/lib/python3.9/site-packages/ansible/plugins/lookup/unvault.py�run+ s &zLookupModule.run)N)�__name__� __module__�__qualname__r r r r r r ) s r N)Z __future__r r r �typeZ __metaclass__Z DOCUMENTATIONZEXAMPLESZRETURNZansible.errorsr Zansible.plugins.lookupr Zansible.module_utils._textr Zansible.utils.displayr r r r r r r �<module> s