܍~c `ddlZddlZddlmZejeZGddeeZdS)N) ConfigSourcec6eZdZdZdZdZdZdZdZdZ dS) ConfigFilez>ConfigFile module to load the content from a specified source.c0||dS)N)_loadConfigFile)selffilenames R/usr/lib/python3/dist-packages/cloudinit/sources/helpers/vmware/imc/config_file.py__init__zConfigFile.__init__s X&&&&&c|}|}|dsd|vrd}nd}|rtd||ntd||||<dS)z Inserts a Key Value pair. Keyword arguments: key -- The key to insert val -- The value to insert for the key -z|-FTzADDED KEY-VAL :: '%s' = '%s'z+ADDED KEY-VAL :: '%s' = '*****************'N)strip startswithloggerdebug)rkeyvalcanLogs r _insertKeyzConfigFile._insertKeysiikkiikk >>#   $#++FFF  M LL7c B B B B LLF L L LS r ctd|tj}t|_||||D]T}t d|| |D]!\}}| |dz|z|"UdS)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. zParsing the config file %s.zFOUND CATEGORY = '%s'|N) rinfo configparser ConfigParserstr optionxformreadclearsectionsritemsr)rr configcategoryrvalues r rzConfigFile._loadConfigFile/s  18<<<*,,  H )) = =H LL0( ; ; ; & X 6 6 = = e3 4e<<<< = = =r c ||vS)z 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. rrs r should_keep_current_valuez$ConfigFile.should_keep_current_valueHs$r c:||vrt|| SdS)a8 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. F)boolr's r should_remove_current_valuez&ConfigFile.should_remove_current_valueVs% $;;DI& &5r c:tfd|DS)z Return the total count of keys that start with the specified prefix. Keyword arguments: prefix -- prefix of the key c>g|]}||Sr&)r).0rprefixs r z4ConfigFile.get_count_with_prefix..ps*BBBC3>>&+A+ABCBBBr )len)rr/s `r get_count_with_prefixz ConfigFile.get_count_with_prefixis(BBBB4BBBCCCr N) __name__ __module__ __qualname____doc__r rrr(r+r2r&r r rrsyHH'''2===2   &DDDDDr r) rlogging2cloudinit.sources.helpers.vmware.imc.config_sourcer getLoggerr3rdictrr&r r r;sKKKKKK  8 $ $`D`D`D`D`Dt`D`D`D`D`Dr