Alon Bar-Lev has uploaded a new change for review. Change subject: packaging: setup: modify AIA port when upgrade from legacy ......................................................................
packaging: setup: modify AIA port when upgrade from legacy in case of moving configuration from jboss as web server and apache as web server we need to modify AIA extension URL. this will not effect past certificate, only new certificate. the engine rename script may be used to refresh the engine certificate. Change-Id: I6d955b34497e3256528180938dc67575d7812646 Signed-off-by: Alon Bar-Lev <alo...@redhat.com> --- M packaging/setup/plugins/ovirt-engine-setup/legacy/ca.py 1 file changed, 75 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/70/18770/1 diff --git a/packaging/setup/plugins/ovirt-engine-setup/legacy/ca.py b/packaging/setup/plugins/ovirt-engine-setup/legacy/ca.py index b5fb0c4..d19efd2 100644 --- a/packaging/setup/plugins/ovirt-engine-setup/legacy/ca.py +++ b/packaging/setup/plugins/ovirt-engine-setup/legacy/ca.py @@ -24,8 +24,10 @@ _ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-setup') +from otopi import constants as otopicons from otopi import util from otopi import plugin +from otopi import filetransaction from ovirt_engine_setup import constants as osetupcons @@ -37,6 +39,58 @@ def __init__(self, context): super(Plugin, self).__init__(context=context) + self._enabled = False + + @plugin.event( + stage=plugin.Stages.STAGE_VALIDATION, + condition=lambda self: ( + self.environment[ + osetupcons.CoreEnv.UPGRADE_FROM_LEGACY + ] and + self.environment[ + osetupcons.ConfigEnv.JBOSS_DIRECT_HTTP_PORT + ] is not None + ), + ) + def _validation(self): + self._enabled = True + + @plugin.event( + stage=plugin.Stages.STAGE_MISC, + condition=lambda self: self._enabled, + ) + def _updateAIA(self): + replace = { + 'from': ':%s/' % self.environment[ + osetupcons.ConfigEnv.JBOSS_DIRECT_HTTP_PORT + ], + 'to': ':%s/' % self.environment[ + osetupcons.ConfigEnv.PUBLIC_HTTP_PORT + ], + } + for name in ( + osetupcons.FileLocations.OVIRT_ENGINE_PKI_CA_TEMPLATE[ + :-len('.in') + ], + osetupcons.FileLocations.OVIRT_ENGINE_PKI_CA_CERT_CONF, + osetupcons.FileLocations.OVIRT_ENGINE_PKI_CERT_TEMPLATE[ + :-len('.in') + ], + osetupcons.FileLocations.OVIRT_ENGINE_PKI_CERT_CONF, + ): + with open(name, 'r') as f: + self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append( + filetransaction.FileTransaction( + name=name, + content=f.read().replace( + replace['from'], + replace['to'] + ).splitlines(), + modifiedList=self.environment[ + otopicons.CoreEnv.MODIFIED_FILES + ], + ) + ) @plugin.event( stage=plugin.Stages.STAGE_MISC, @@ -79,4 +133,25 @@ fileList=uninstall_files, ) + @plugin.event( + stage=plugin.Stages.STAGE_CLOSEUP, + condition=lambda self: self._enabled, + ) + def _closeup(self): + self.logger.warning( + _( + 'Engine port was modified from port {oldport} to {newport}.\n' + 'Consider to run rename script to re-issue web certificate ' + 'with current port within AIA extension.\n' + ).format( + oldport=self.environment[ + osetupcons.ConfigEnv.JBOSS_DIRECT_HTTP_PORT + ], + newport=self.environment[ + osetupcons.ConfigEnv.PUBLIC_HTTP_PORT + ], + ) + ) + + # vim: expandtab tabstop=4 shiftwidth=4 -- To view, visit http://gerrit.ovirt.org/18770 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6d955b34497e3256528180938dc67575d7812646 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.3 Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches