Sandro Bonazzola has uploaded a new change for review. Change subject: packaging: setup: upgrade firewalld config ......................................................................
packaging: setup: upgrade firewalld config upgrade firewalld configuration from legacy 3.2.z where there was an ovirt service that is not used anymore from 3.3.0. Requires: http://gerrit.ovirt.org/17026 Change-Id: I9adc2a32e17d687f0eae546c83685e4a7f5b38e7 Signed-off-by: Sandro Bonazzola <[email protected]> --- M packaging/setup/ovirt_engine_setup/constants.py M packaging/setup/plugins/ovirt-engine-setup/legacy/__init__.py A packaging/setup/plugins/ovirt-engine-setup/legacy/firewalld.py 3 files changed, 94 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/27/17027/1 diff --git a/packaging/setup/ovirt_engine_setup/constants.py b/packaging/setup/ovirt_engine_setup/constants.py index 09ed76f..97982ac 100644 --- a/packaging/setup/ovirt_engine_setup/constants.py +++ b/packaging/setup/ovirt_engine_setup/constants.py @@ -124,6 +124,13 @@ '.pgpass', ) + LEGACY_FIREWALLD_SERVICE_FILE = os.path.join( + SYSCONFDIR, + 'firewalld', + 'services', + 'ovirt.xml' + ) + OVIRT_ENGINE_DB_UTILS_DIR = os.path.join( OVIRT_ENGINE_DATADIR, 'setup', diff --git a/packaging/setup/plugins/ovirt-engine-setup/legacy/__init__.py b/packaging/setup/plugins/ovirt-engine-setup/legacy/__init__.py index d246096..8f9f4e0 100644 --- a/packaging/setup/plugins/ovirt-engine-setup/legacy/__init__.py +++ b/packaging/setup/plugins/ovirt-engine-setup/legacy/__init__.py @@ -27,6 +27,7 @@ from . import core from . import datadomain from . import firewall_manager +from . import firewalld from . import isodomain from . import database from . import ca @@ -39,6 +40,7 @@ core.Plugin(context=context) datadomain.Plugin(context=context) firewall_manager.Plugin(context=context) + firewalld.Plugin(context=context) isodomain.Plugin(context=context) database.Plugin(context=context) ca.Plugin(context=context) diff --git a/packaging/setup/plugins/ovirt-engine-setup/legacy/firewalld.py b/packaging/setup/plugins/ovirt-engine-setup/legacy/firewalld.py new file mode 100644 index 0000000..59aa859 --- /dev/null +++ b/packaging/setup/plugins/ovirt-engine-setup/legacy/firewalld.py @@ -0,0 +1,85 @@ +# +# ovirt-engine-setup -- ovirt engine setup +# Copyright (C) 2013 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +"""Upgrade firewalld configuration from legacy plugin.""" + + +import os +import gettext +_ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-setup') + + +from otopi import util +from otopi import plugin +from otopi import constants as otopicons +from otopi import filetransaction + + +from ovirt_engine_setup import constants as osetupcons + + [email protected] +class Plugin(plugin.PluginBase): + """Upgrade firewalld configuration from legacy plugin.""" + + def __init__(self, context): + super(Plugin, self).__init__(context=context) + + @plugin.event( + stage=plugin.Stages.STAGE_MISC, + condition=lambda self: self.environment[ + osetupcons.CoreEnv.UPGRADE_FROM_LEGACY + ], + ) + def _misc(self): + if os.path.exists( + osetupcons.FileLocations.LEGACY_FIREWALLD_SERVICE_FILE + ): + self.environment[otopicons.NetEnv.FIREWALLD_DISBALE_SERVICES] = [ + os.path.splitext( + os.path.basename( + osetupcons.FileLocations. + LEGACY_FIREWALLD_SERVICE_FILE + ) + )[0], + ] + self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append( + filetransaction.FileTransaction( + name=( + osetupcons.FileLocations.LEGACY_FIREWALLD_SERVICE_FILE + ), + content='', + ) + ) + + @plugin.event( + stage=plugin.Stages.STAGE_CLOSEUP, + condition=lambda self: self.environment[ + osetupcons.CoreEnv.UPGRADE_FROM_LEGACY + ], + priority=plugin.Stages.PRIORITY_LOW, + ) + def _closeup(self): + #Priorirty low because we want to remove the file after firewalld + #plugin closeup + if os.path.exists( + osetupcons.FileLocations.LEGACY_FIREWALLD_SERVICE_FILE + ): + os.remove(osetupcons.FileLocations.LEGACY_FIREWALLD_SERVICE_FILE) + +# vim: expandtab tabstop=4 shiftwidth=4 -- To view, visit http://gerrit.ovirt.org/17027 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9adc2a32e17d687f0eae546c83685e4a7f5b38e7 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Sandro Bonazzola <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
