관리-도구
편집 파일: manager.cpython-39.pyc
a �)gR� � @ sp d dl mZmZmZ eZd dlZd dlZd dlm Z d dl mZmZm Z d dlmZ d dlmZ d dlmZ d dlmZmZmZmZmZmZ d d lmZ d d lmZm Z d dl!m"Z" d dl#m$Z$m%Z% d d l&m'Z' d dl(m)Z) d dl*m+Z+ d dl,m-Z- d dl.m/Z/ d dl0m1Z1m2Z2m3Z3 d dl4m5Z5 d dl6m7Z7m8Z8 d dl9m:Z:m;Z; e-� Z<dd� Z=G dd� d�Z>G dd� de�Z?dS )� )�absolute_import�division�print_functionN)�defaultdict)�Mapping�MutableMapping�Sequence)�sha1)�UndefinedError)� constants)�AnsibleError�AnsibleParserError�AnsibleUndefinedVariable�AnsibleFileNotFound�AnsibleAssertionError�AnsibleTemplateError)�Host)�sort_groups�get_group_vars)�to_text)� text_type�string_types)� lookup_loader)� FactCache)�Templar)�Display)�listify_lookup_plugin_terms)�combine_vars�load_extra_vars�load_options_vars)�wrap_var)�namespace_facts�clean_facts)�get_vars_from_inventory_sources�get_vars_from_pathc C sN | du rdS t | t�s| g}n| }|D ]"}t |t�s&td| t| �f ��q&|S )z� Ensures that vars contained in the parameter passed in are returned as a list of dictionaries, to ensure for instance that vars loaded from a file conform to an expected state. Nzevariable files must contain either a dictionary of variables, or a list of dictionaries. Got: %s (%s))� isinstance�listr r �type)�a�data�item� r+ �8/usr/lib/python3.9/site-packages/ansible/vars/manager.py�preprocess_vars2 s r- c @ s� e Zd Zeg d��Zddd�Zdd� Zdd� Zed d � �Z dd� Z ddd�Zddd�Zdd� Z dd� Zdd� Zdd� Zdd� ZdS ) �VariableManager)Zplugins_by_group�groups_plugins_play�groups_plugins_inventory�groups_inventory�all_plugins_play�all_plugins_inventory� all_inventoryNc C s� t t�| _t t�| _t t�| _t t�| _t t�| _|| _|| _d | _ dt t�d��� � | _t|�| _| j�dd�}t|du p�|�| _t| jd�| _zt� | _W n8 ty� } z t�t|�� i | _W Y d }~n d }~0 0 d S )N�__omit_place_holder__%s�@ �basedirF��loader)r �dict�_nonpersistent_fact_cache�_vars_cache�_extra_vars�_host_vars_files�_group_vars_files� _inventory�_loader� _hostvarsr �os�urandom� hexdigest�_omit_tokenr � _options_vars�get�bool�safe_basedirr r �_fact_cacher �display�warningr )�selfr9 � inventory�version_infor7 �er+ r+ r, �__init__L s$ zVariableManager.__init__c C s4 t | j| j| j| j| j| j| j| j| j | j d� }|S )N) � fact_cache� np_fact_cache� vars_cache� extra_vars�host_vars_files�group_vars_files� omit_token�options_varsrO rJ )r: rK r; r<