#NEWLINE# def set_option( file_name , sections = None , separator = '=' ) : #NEWLINE# #INDENT# '\n    Edit an ini file, replacing one or more sections. Returns a dictionary\n    containing the changes made.\n\n    file_name\n        path of ini_file\n\n    sections : None\n        A dictionary representing the sections to be edited ini file\n        The keys are the section names and the values are the dictionary\n        containing the options\n        If the Ini does not contain sections the keys and values represent the\n        options\n\n    separator : =\n        A character used to separate keys and values. Standard ini files use\n        the "=" character.\n\n        .. versionadded:: Carbon\n\n    API Example:\n\n    .. code-block:: python\n\n        import salt\n        sc = salt.client.get_local_client()\n        sc.cmd(\'target\', \'ini.set_option\',\n               [\'path_to_ini_file\', \'{"section_to_change": {"key": "value"}}\'])\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt \'*\' ini.set_option /path/to/ini \'{section_foo: {key: value}}\'\n    ' #NEWLINE# sections = ( sections or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# changes = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# inifile = _Ini . get_ini_file ( file_name , separator = separator ) #NEWLINE# if ( not inifile ) : #NEWLINE# #INDENT# changes . update ( { #NEWLINE# #INDENT# 'error' : 'ini file not found' , #NEWLINE# #UNINDENT# } ) #NEWLINE# return changes #NEWLINE# #UNINDENT# changes = inifile . update ( sections ) #NEWLINE# inifile . flush ( ) #NEWLINE# return changes