HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //lib/python3.9/site-packages/ansible/plugins/lookup/__pycache__/file.cpython-39.pyc
a

�)g��@srddlmZmZmZeZdZdZdZddl	m
Z
mZddlm
Z
ddlmZddlmZe�ZGd	d
�d
e
�ZdS)�)�absolute_import�division�print_functiona�
    name: file
    author: Daniel Hokka Zakrisson (!UNKNOWN) <[email protected]>
    version_added: "0.9"
    short_description: read file contents
    description:
        - This lookup returns the contents from a file on the Ansible controller's file system.
    options:
      _terms:
        description: path(s) of files to read
        required: True
      rstrip:
        description: whether or not to remove whitespace from the ending of the looked-up file
        type: bool
        required: False
        default: True
      lstrip:
        description: whether or not to remove whitespace from the beginning of the looked-up file
        type: bool
        required: False
        default: False
    notes:
      - if read in variable context, the file can be interpreted as YAML if the content is valid to the parser.
      - this lookup does not understand 'globbing', use the fileglob lookup instead.
aF
- ansible.builtin.debug:
    msg: "the value of foo.txt is {{lookup('ansible.builtin.file', '/etc/foo.txt') }}"

- name: display multiple file contents
  ansible.builtin.debug: var=item
  with_file:
    - "/path/to/foo.txt"
    - "bar.txt"  # will be looked in files/ dir relative to play or in role
    - "/path/to/biz.txt"
zV
  _raw:
    description:
      - content of file(s)
    type: list
    elements: str
)�AnsibleError�AnsibleParserError)�
LookupBase)�to_text)�Displayc@seZdZddd�ZdS)�LookupModuleNc
	Ks�g}|j||d�|D]�}t�d|�|�|d|�}t�d|�zZ|r�|j�|�\}}t|dd�}	|�d�rx|	�	�}	|�d�r�|	�
�}	|�|	�nt��Wqty�t
d	|��Yq0q|S)
N)Zvar_optionsZdirectzFile lookup term: %s�fileszFile lookup using %s as fileZsurrogate_or_strict)�errors�lstrip�rstripz#could not locate file in lookup: %s)Zset_options�display�debugZfind_file_in_search_pathZvvvvZ_loaderZ_get_file_contentsrZ
get_optionr
r�appendrr)
�selfZtermsZ	variables�kwargs�retZtermZ
lookupfileZ
b_contentsZ	show_data�contents�r�?/usr/lib/python3.9/site-packages/ansible/plugins/lookup/file.py�run?s&


zLookupModule.run)N)�__name__�
__module__�__qualname__rrrrrr
=sr
N)Z
__future__rrr�typeZ
__metaclass__Z
DOCUMENTATIONZEXAMPLESZRETURNZansible.errorsrrZansible.plugins.lookuprZansible.module_utils._textrZansible.utils.displayr	rr
rrrr�<module>s