Yedidyah Bar David has uploaded a new change for review. Change subject: packaging: setup: add keep_existing to editConfigContent ......................................................................
packaging: setup: add keep_existing to editConfigContent Add an option to editConfigContent to keep existing params if found. With this option, only params that do not appear in the input will be added in the end. Change-Id: Ib41cf1773e015f34c66fc7aaef0a079a7ccc8845 Signed-off-by: Yedidyah Bar David <d...@redhat.com> --- M packaging/setup/ovirt_engine_setup/util.py 1 file changed, 8 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/74/39774/1 diff --git a/packaging/setup/ovirt_engine_setup/util.py b/packaging/setup/ovirt_engine_setup/util.py index a8d14b2..22b8fd1 100644 --- a/packaging/setup/ovirt_engine_setup/util.py +++ b/packaging/setup/ovirt_engine_setup/util.py @@ -37,6 +37,7 @@ def editConfigContent( content, params, + keep_existing=False, changed_lines=None, comment_re='[#]*\s*', new_comment_tpl='{spaces}# {original}', @@ -50,6 +51,8 @@ content - a list of strings, the content prior to calling us params - a dict of params/values that should be in the output If the value for a param is None, param is deleted + keep_existing - if True, existing params are not changed, only missing + ones are added. changed_lines - an output parameter, a list of dictionaries with added and removed lines. comment_re - a regular expression that a comment marker prefixed @@ -121,9 +124,12 @@ ): if ( not f.group('comment') and - str(f.group('value')) == str(params[f.group('param')]) + ( + str(f.group('value')) == str(params[f.group('param')]) or + keep_existing + ) ): - # value is not changed, do nothing + # value is not changed, or we do not care. do nothing processed.add(f.group('param')) else: if ( -- To view, visit https://gerrit.ovirt.org/39774 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib41cf1773e015f34c66fc7aaef0a079a7ccc8845 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yedidyah Bar David <d...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches