Lev Veyde has uploaded a new change for review. Change subject: packaging: setup: Inform the user about availability of DWH and Reports ......................................................................
packaging: setup: Inform the user about availability of DWH and Reports Change-Id: I61fb88a6430eec6b6425075df0e749644654753a Signed-off-by: Lev Veyde <[email protected]> Bug-Url: https://bugzilla.redhat.com/877224 --- M packaging/setup/ovirt_engine_setup/constants.py M packaging/setup/ovirt_engine_setup/engine/constants.py M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/core/__init__.py A packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/core/advertise_dwh.py 4 files changed, 132 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/77/38277/1 diff --git a/packaging/setup/ovirt_engine_setup/constants.py b/packaging/setup/ovirt_engine_setup/constants.py index b735e44..b0e24d9 100644 --- a/packaging/setup/ovirt_engine_setup/constants.py +++ b/packaging/setup/ovirt_engine_setup/constants.py @@ -259,6 +259,8 @@ REMOTE_ENGINE_SETUP_STYLE_AUTO_SSH = 'auto_ssh' REMOTE_ENGINE_SETUP_STYLE_MANUAL_FILES = 'manual_files' REMOTE_ENGINE_SETUP_STYLE_MANUAL_INLINE = 'manual_inline' + DWH_DOC_URL = 'http://www.ovirt.org/Ovirt_DWH' + REPORTS_DOC_URL = 'http://www.ovirt.org/Ovirt_Reports' @util.export @@ -301,6 +303,14 @@ @util.export @util.codegen @osetupattrsclass +class DocsEnv(object): + DOCS_LOCAL = 'OVESETUP_DOCS/docsAreLocal' + DWH_DOC_URL = 'OVESETUP_DOCS/dwhDocUrl' + REPORTS_DOC_URL = 'OVESETUP_DOCS/reportsDocUrl' + [email protected] [email protected] +@osetupattrsclass class DialogEnv(object): @osetupattrs( answerfile=True, diff --git a/packaging/setup/ovirt_engine_setup/engine/constants.py b/packaging/setup/ovirt_engine_setup/engine/constants.py index acc1841..a79a5f8 100644 --- a/packaging/setup/ovirt_engine_setup/engine/constants.py +++ b/packaging/setup/ovirt_engine_setup/engine/constants.py @@ -36,6 +36,25 @@ from . import config +# Sync with dwh/reports _upstream_ + [email protected] [email protected] +@osetupattrsclass +class DWHCoreEnv(object): + """Sync with ovirt-dwh""" + + ENABLE = 'OVESETUP_DWH_CORE/enable' + + [email protected] [email protected] +@osetupattrsclass +class ReportsCoreEnv(object): + """Sync with ovirt-reports""" + + ENABLE = 'OVESETUP_REPORTS_CORE/enable' + @util.export class FileLocations(object): diff --git a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/core/__init__.py b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/core/__init__.py index 1a604a4..f718585 100644 --- a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/core/__init__.py +++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/core/__init__.py @@ -23,11 +23,11 @@ from . import misc - +from . import advertise_dwh @util.export def createPlugins(context): misc.Plugin(context=context) - + advertise_dwh.Plugin(context=context) # vim: expandtab tabstop=4 shiftwidth=4 diff --git a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/core/advertise_dwh.py b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/core/advertise_dwh.py new file mode 100644 index 0000000..2bc79fd --- /dev/null +++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/core/advertise_dwh.py @@ -0,0 +1,101 @@ +# +# ovirt-engine-setup -- ovirt engine setup +# Copyright (C) 2015 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. +# + +"""Advertise DWH and Reports plugin.""" + +import gettext +_ = 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 ovirt_engine_setup import dialog +from ovirt_engine_setup import constants as osetupcons +from ovirt_engine_setup.engine import constants as oenginecons +from ovirt_engine_setup.engine_common import constants as oengcommcons + [email protected] +class Plugin(plugin.PluginBase): + """Advertise DWH and Reports plugin.""" + + def __init__(self, context): + super(Plugin, self).__init__(context=context) + + @plugin.event( + stage=plugin.Stages.STAGE_CLOSEUP, + before=( + osetupcons.Stages.DIALOG_TITLES_E_SUMMARY, + ), + after=( + osetupcons.Stages.DIALOG_TITLES_S_SUMMARY, + ), + condition=lambda self: self.environment[oenginecons.CoreEnv.ENABLE], + ) + def _closeup(self): + # TODO + # layout of jboss and proxy should be the same + self.environment.setdefault( + osetupcons.DocsEnv.DOCS_LOCAL, + False + ) + + self.environment.setdefault( + osetupcons.DocsEnv.DWH_DOC_URL, + osetupcons.Const.DWH_DOC_URL + ) + + self.environment.setdefault( + osetupcons.DocsEnv.REPORTS_DOC_URL, + osetupcons.Const.REPORTS_DOC_URL + ) + + if not self.environment.get(oenginecons.DWHCoreEnv.ENABLE) and not self.environment.get(oenginecons.ReportsCoreEnv.ENABLE): + if not self.environment.get(osetupcons.DocsEnv.DOCS_LOCAL): + self.dialog.note( + text=_( + 'Note! If you want to gather statistical information you can install Reports and/or DHW:\n' + ' {dwhURL}\n' + ' {reportsURL}\n' + ).format( + dwhURL=self.environment[osetupcons.DocsEnv.DWH_DOC_URL], + reportsURL=self.environment[osetupcons.DocsEnv.REPORTS_DOC_URL], + ) + ) + else: + if self.environment[oengcommcons.ConfigEnv.JBOSS_AJP_PORT]: + engineURI = oenginecons.Const.ENGINE_URI + else: + engineURI = '/' + + self.dialog.note( + text=_( + 'Note! If you want to gather statistical information you can install Reports and/or DHW:\n' + ' http://{fqdn}:{httpPort}{engineURI}{dwhURL}\n' + ).format( + fqdn=self.environment[osetupcons.ConfigEnv.FQDN], + httpPort=self.environment[ + oengcommcons.ConfigEnv.PUBLIC_HTTP_PORT + ], + httpsPort=self.environment[ + oengcommcons.ConfigEnv.PUBLIC_HTTPS_PORT + ], + engineURI=engineURI, + dwhURL=self.environment[osetupcons.DocsEnv.DWH_DOC_URL], + reportsURL=self.environment[osetupcons.DocsEnv.REPORTS_DOC_URL], + ) + ) -- To view, visit https://gerrit.ovirt.org/38277 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I61fb88a6430eec6b6425075df0e749644654753a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Lev Veyde <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
