new
re
all
Remove a key/value pair from an ini file. Key/value pairs present in the ini file and not specified in sections dict will be untouched.
name (str) -- The path to the ini file
sections (dict) -- A dictionary of sections and key/value pairs that will be removed from the ini file. Other key/value pairs in the ini file will be untouched.
separator (str) -- The character used to separate keys and values. Standard ini files
use the "=" character. The default is =.
encoding (str) --
A string value representing encoding of the target ini file. If
None is passed, it uses the system default which is likely
utf-8. Default is None
New in version 3006.10.
A dictionary containing list of changes made
Example:
/home/saltminion/api-paste.ini:
ini.options_absent:
- separator: '='
- sections:
test:
- testkey
- secondoption
test1:
- testkey1
Set or create a key/value pair in an ini file. Options present in the
ini file and not specified in the sections dict will be untouched, unless
the strict: True flag is used.
Sections that do not exist will be created.
name (str) -- The path to the ini file
sections (dict) -- A dictionary of sections and key/value pairs that will be used to
update the ini file. Other sections and key/value pairs in the ini
file will be untouched unless strict: True is passed.
separator (str) -- The character used to separate keys and values. Standard ini files
use the "=" character. The default is =.
strict (bool) -- A boolean value that specifies that the sections dictionary
contains all settings in the ini file. True will create an ini
file with only the values specified in sections. False will
append or update values in an existing ini file and leave the rest
untouched.
encoding (str) --
A string value representing encoding of the target ini file. If
None is passed, it uses the system default which is likely
utf-8. Default is None
New in version 3006.10.
no_spaces (bool) --
A bool value that specifies that the key/value separator will be
wrapped with spaces. This parameter was added to have the ability to
not wrap the separator with spaces. Default is False, which
maintains backwards compatibility.
Warning
This will affect all key/value pairs in the ini file, not just the specific value being set.
New in version 3006.10.
A dictionary containing list of changes made
Example:
/home/saltminion/api-paste.ini:
ini.options_present:
- separator: '='
- strict: True
- sections:
test:
testkey: 'testval'
secondoption: 'secondvalue'
test1:
testkey1: 'testval121'
Remove sections from the ini file. All key/value pairs in the section will also be removed.
name (str) -- The path to the ini file
sections (dict) -- A dictionary of sections and key/value pairs that will be used to
update the ini file. Other sections and key/value pairs in the ini
file will be untouched unless strict: True is passed.
separator (str) -- The character used to separate keys and values. Standard ini files
use the "=" character. The default is =.
encoding (str) --
A string value representing encoding of the target ini file. If
None is passed, it uses the system default which is likely
utf-8. Default is None
New in version 3006.6.
A dictionary containing list of changes made
Example:
/home/saltminion/api-paste.ini:
ini.sections_absent:
- separator: '='
- sections:
- test
- test1
Add sections to an ini file. This will only create empty sections. To also create key/value pairs, use options_present state.
name (str) -- The path to the ini file
sections (dict) -- A dictionary of sections and key/value pairs that will be used to update the ini file. Only the sections portion is used, key/value pairs are ignored. To also set key/value pairs, use the options_present state.
separator (str) -- The character used to separate keys and values. Standard ini files
use the "=" character. The default is =.
encoding (str) --
A string value representing encoding of the target ini file. If
None is passed, it uses the system default which is likely
utf-8. Default is None
New in version 3006.10.
A dictionary containing list of changes made
Example:
/home/saltminion/api-paste.ini:
ini.sections_present:
- separator: '='
- sections:
- section_one
- section_two