관리-도구
편집 파일: ini.cpython-39.pyc
a �)gc � @ s� d dl mZmZmZ eZdZdZdZd dl Z d dl Z d dlZd dlm Z d dlmZ d dlmZ d d lmZmZ d d lmZmZ d dlmZ dd � ZG dd� de�ZdS )� )�absolute_import�division�print_functiona� name: ini author: Yannig Perre (!UNKNOWN) <yannig.perre(at)gmail.com> version_added: "2.0" short_description: read data from an ini file description: - "The ini lookup reads the contents of a file in INI format C(key1=value1). This plugin retrieves the value on the right side after the equal sign C('=') of a given section C([section])." - "You can also read a property file which - in this case - does not contain section." options: _terms: description: The key(s) to look up. required: True type: description: Type of the file. 'properties' refers to the Java properties files. default: 'ini' choices: ['ini', 'properties'] file: description: Name of the file to load. default: 'ansible.ini' section: default: global description: Section where to lookup the key. re: default: False type: boolean description: Flag to indicate if the key supplied is a regexp. encoding: default: utf-8 description: Text encoding to use. default: description: Return value if the key is not in the ini file. default: '' case_sensitive: description: Whether key names read from C(file) should be case sensitive. This prevents duplicate key errors if keys only differ in case. default: False version_added: '2.12' allow_no_value: description: - Read an ini file which contains key without value and without '=' symbol. type: bool default: False aliases: ['allow_none'] version_added: '2.12' a� - ansible.builtin.debug: msg="User in integration is {{ lookup('ansible.builtin.ini', 'user', section='integration', file='users.ini') }}" - ansible.builtin.debug: msg="User in production is {{ lookup('ansible.builtin.ini', 'user', section='production', file='users.ini') }}" - ansible.builtin.debug: msg="user.name is {{ lookup('ansible.builtin.ini', 'user.name', type='properties', file='user.properties') }}" - ansible.builtin.debug: msg: "{{ item }}" loop: "{{ q('ansible.builtin.ini', '.*', section='section1', file='test.ini', re=True) }}" - name: Read an ini file with allow_no_value ansible.builtin.debug: msg: "{{ lookup('ansible.builtin.ini', 'user', file='mysql.ini', section='mysqld', allow_no_value=True) }}" z` _raw: description: - value(s) of the key(s) in the ini file type: list elements: str N)�StringIO)�defaultdict)�MutableSequence)�AnsibleLookupError�AnsibleOptionsError)�to_text� to_native)� LookupBasec s� |� � }tdd� �� g }d}t| �� �D ]b\}}d|v rR|D ]}d| |v r<|}q<|dksb� | sv|� |<