Alon Bar-Lev has uploaded a new change for review. Change subject: packaging: setup: support legacy ovirt-engine config preserve on rollback ......................................................................
packaging: setup: support legacy ovirt-engine config preserve on rollback do not backup/remove previous as we will not read these anyway, and wish to reduce complexity. Change-Id: I5f7a054b96823a283c5e8267267597e316b5b5cc Signed-off-by: Alon Bar-Lev <[email protected]> --- M packaging/setup/plugins/ovirt-engine-setup/legacy/config.py 1 file changed, 22 insertions(+), 22 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/17231/1 diff --git a/packaging/setup/plugins/ovirt-engine-setup/legacy/config.py b/packaging/setup/plugins/ovirt-engine-setup/legacy/config.py index dd3b933..1576624 100644 --- a/packaging/setup/plugins/ovirt-engine-setup/legacy/config.py +++ b/packaging/setup/plugins/ovirt-engine-setup/legacy/config.py @@ -20,6 +20,7 @@ import os +import glob import gettext _ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-setup') @@ -108,29 +109,28 @@ ], ) def _misc(self): - if os.path.exists( - osetupcons.FileLocations.LEGACY_OVIRT_ENGINE_SYSCONFIG - ): - self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append( - filetransaction.FileTransaction( - name=( - osetupcons.FileLocations.LEGACY_OVIRT_ENGINE_SYSCONFIG - ), - content='', - ) - ) + legacy = osetupcons.FileLocations.LEGACY_OVIRT_ENGINE_SYSCONFIG + legacy_rpmsave = legacy + '.rpmsave' + legacy_confd = legacy + '.d' - @plugin.event( - stage=plugin.Stages.STAGE_CLOSEUP, - condition=lambda self: self.environment[ - osetupcons.CoreEnv.UPGRADE_FROM_LEGACY - ], - ) - def _closeup(self): - if os.path.exists( - osetupcons.FileLocations.LEGACY_OVIRT_ENGINE_SYSCONFIG - ): - os.remove(osetupcons.FileLocations.LEGACY_OVIRT_ENGINE_SYSCONFIG) + if os.path.exists(legacy_rpmsave) and not os.path.exists(legacy): + os.rename(legacy_rpmsave, legacy) + + if os.path.exists(legacy_confd): + for n in glob.glob(os.path.join(legacy_confd, '*.conf')): + with open(n, 'r') as f: + self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append( + filetransaction.FileTransaction( + name=os.path.join( + ( + osetupcons.FileLocations. + OVIRT_ENGINE_SERVICE_CONFIGD + ), + os.path.basename(n), + ), + content=f.read().splitlines(), + ) + ) # vim: expandtab tabstop=4 shiftwidth=4 -- To view, visit http://gerrit.ovirt.org/17231 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5f7a054b96823a283c5e8267267597e316b5b5cc Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
