Feature request: ini.managed all-in-one state #67489
oeuftete
started this conversation in
Feature Requests
Replies: 1 comment
-
|
The proposed feature would be exactly what I need. The workaround has the drawback that if I remove one of the ini modifications from the state and run again, change is not reflected in the target until the source changes and the target is recreated. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description of Issue
(ref. ZD-4366)
To simplify the maintenance and change reporting of ini file management states, especially when building an ini from a standard starting point, it would be useful to have an all-in-one state, perhaps
ini.managed.Here's how it might look.
That state would get the source file, perform the various options and sections modifications to it as in the standalone ini states, and only if that result differs from
target.iniwould the state return with changes.The current workaround looks a bit like:
{% set SALT_REFERENCE = 'salt://vanilla.ini' %} {% set LOCAL_REFERENCE = 'local_reference.ini' %} {% set LOCAL_TMP = '/tmp/tmp.ini' %} {% set LOCAL_FINAL = 'target.ini' %} get_ini_from_source_if_changed: file.managed: - name: {{ LOCAL_REFERENCE }} - source: {{ SALT_REFERENCE }} rebuild_ini_if_reference_changed: file.managed: - name: {{ LOCAL_TMP }} - source: {{ SALT_REFERENCE }} - onchanges: - file: get_ini_from_source_if_changed apply_ini_modifications: ini.options_present: - name: {{ LOCAL_TMP }} - sections: test: testkey: 'testval' {# ... more ini states possibly ... #} copy_tmp_ini_to_target: file.managed: - name: {{ LOCAL_FINAL }} - source: {{ LOCAL_TMP }}Beta Was this translation helpful? Give feedback.
All reactions