
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
3
\me                 @   s<   d dl Z d dlZd dlmZ ejeZG dd deeZdS )    N)ConfigSourcec               @   s0   e Zd ZdZdd Zdd Zdd Zdd	 Zd
S )
ConfigFilez>ConfigFile module to load the content from a specified source.c             C   s   | j | d S )N)_loadConfigFile)selffilename r   !/usr/lib/python3.6/config_file.py__init__   s    zConfigFile.__init__c             C   sX   |j  }|j  }|jds"d|kr(d}nd}|r@tjd|| ntjd| || |< dS )z
        Inserts a Key Value pair.

        Keyword arguments:
        key -- The key to insert
        val -- The value to insert for the key

        -z|-FTzADDED KEY-VAL :: '%s' = '%s'z+ADDED KEY-VAL :: '%s' = '*****************'N)strip
startswithloggerdebug)r   keyvalZcanLogr   r   r   
_insertKey   s    	zConfigFile._insertKeyc             C   sz   t jd| tj }t|_|j| | j  xH|j D ]<}t j	d| x*|j
|D ]\}}| j|d | | qRW q6W dS )a%  
        Parses properties from the specified config file.

        Any previously available properties will be removed.
        Sensitive data will not be logged in case the key starts
        from '-'.

        Keyword arguments:
        filename - The full path to the config file.
        zParsing the config file %s.zFOUND CATEGORY = '%s'|N)r   infoconfigparserZConfigParserstrZoptionxformreadclearZsectionsr   itemsr   )r   r   configcategoryr   valuer   r   r   r   /   s    
zConfigFile._loadConfigFilec                s   t  fdd| D S )z
        Return the total count of keys that start with the specified prefix.

        Keyword arguments:
        prefix -- prefix of the key
        c                s   g | ]}|j  r|qS r   )r   ).0r   )prefixr   r   
<listcomp>O   s    z4ConfigFile.get_count_with_prefix.<locals>.<listcomp>)len)r   r   r   )r   r   get_count_with_prefixH   s    z ConfigFile.get_count_with_prefixN)__name__
__module____qualname____doc__r	   r   r   r    r   r   r   r   r      s
   r   )	r   ZloggingZ2cloudinit.sources.helpers.vmware.imc.config_sourcer   Z	getLoggerr!   r   dictr   r   r   r   r   <module>   s   
