Current File : //usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/config_file.pyo
�
oB�]c@sxddlZyddlZWnek
r;ddlZnXddlmZeje�Zdee	fd��YZ
dS(i����Ni(tConfigSourcet
ConfigFilecBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s>ConfigFile module to load the content from a specified source.cCs|j|�dS(N(t_loadConfigFile(tselftfilename((sT/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/config_file.pyt__init__s
cCs||j�}|j�}|jd�s3d|kr<t}nt}|r^tjd||�ntjd|�|||<dS(s�
        Inserts a Key Value pair.

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

        t-s|-sADDED KEY-VAL :: '%s' = '%s's+ADDED KEY-VAL :: '%s' = '*****************'N(tstript
startswithtFalsetTruetloggertdebug(RtkeytvaltcanLog((sT/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/config_file.pyt
_insertKeys		cCs�tjd|�tj�}t|_|j|�|j�x\|j�D]N}tj	d|�x5|j
|�D]$\}}|j|d||�qoWqIWdS(s%
        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.
        sParsing the config file %s.sFOUND CATEGORY = '%s't|N(RtinfotconfigparsertConfigParsertstrtoptionxformtreadtcleartsectionsRtitemsR(RRtconfigtcategoryR
tvalue((sT/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/config_file.pyR4s	

cCs
||kS(s�
        Determines whether a value for a property must be kept.

        If the propery is missing, it is treated as it should be not
        changed by the engine.

        Keyword arguments:
        key -- The key to search for.
        ((RR
((sT/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/config_file.pytshould_keep_current_valueMscCs#||krt||�StSdS(s8
        Determines whether a value for the property must be removed.

        If the specified key is empty, it is treated as it should be
        removed by the engine.

        Return true if the value can be removed, false otherwise.

        Keyword arguments:
        key -- The key to search for.
        N(tboolR	(RR
((sT/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/config_file.pytshould_remove_current_value[scCs,tg|D]}|j|�r
|^q
�S(s�
        Return the total count of keys that start with the specified prefix.

        Keyword arguments:
        prefix -- prefix of the key
        (tlenR(RtprefixR
((sT/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/config_file.pytget_count_with_prefixns(	t__name__t
__module__t__doc__RRRRR R#(((sT/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/config_file.pyRs					(tloggingRtImportErrorRt
config_sourceRt	getLoggerR$RtdictR(((sT/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/config_file.pyt<module>s