
    x[h                     \    S SK r S SKrS SKJr  \R                  " \5      r " S S\\5      rg)    N)ConfigSourcec                   0    \ rS rSrSrS rS rS rS rSr	g)	
ConfigFile   z>ConfigFile module to load the content from a specified source.c                 &    U R                  U5        g )N)_loadConfigFile)selffilenames     R/usr/lib/python3/dist-packages/cloudinit/sources/helpers/vmware/imc/config_file.py__init__ConfigFile.__init__   s    X&    c                     UR                  5       nUR                  5       nUR                  S5      (       d  SU;   a  SnOSnU(       a  [        R                  SX5        O[        R                  SU5        X U'   g)zp
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valcanLogs       r   
_insertKeyConfigFile._insertKey   sc     iikiik>>#$#+FF LL7BLLFLS	r   c                 p   [         R                  SU5        [        R                  " 5       n[        Ul        UR                  U5        U R                  5         UR                  5        HK  n[         R                  SU5        UR                  U5       H  u  pEU R                  US-   U-   U5        M     MM     g)z
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configparserConfigParserstroptionxformreadclearsectionsr   itemsr   )r	   r
   configcategoryr   values         r   r   ConfigFile._loadConfigFile/   s     	18<**, H

)HLL0(;$ll84
3 4e< 5 *r   c                 r    [        U  Vs/ s H  o"R                  U5      (       d  M  UPM     sn5      $ s  snf )zv
Return the total count of keys that start with the specified prefix.

Keyword arguments:
prefix -- prefix of the key
)lenr   )r	   prefixr   s      r   get_count_with_prefix ConfigFile.get_count_with_prefixH   s*     4B4C>>&+AC4BCCBs   44 N)
__name__
__module____qualname____firstlineno____doc__r   r   r   r,   __static_attributes__r.   r   r   r   r      s    H'2=2Dr   r   )	r   logging2cloudinit.sources.helpers.vmware.imc.config_sourcer   	getLoggerr/   r   dictr   r.   r   r   <module>r9      s0      K			8	$?Dt ?Dr   