Yedidyah Bar David has uploaded a new change for review. Change subject: packaging: setup: make backup dir configurable ......................................................................
packaging: setup: make backup dir configurable Change-Id: I1526e84d389c464f4eddc4f56b0d8b27a92edf81 Bug-Url: https://bugzilla.redhat.com/1110919 Signed-off-by: Yedidyah Bar David <[email protected]> --- M packaging/setup/ovirt_engine_setup/reports/constants.py M packaging/setup/plugins/ovirt-engine-common/ovirt-engine-reports/db/__init__.py A packaging/setup/plugins/ovirt-engine-common/ovirt-engine-reports/db/config.py M packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-reports/db/clear.py M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py 5 files changed, 66 insertions(+), 12 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-reports refs/changes/53/38253/1 diff --git a/packaging/setup/ovirt_engine_setup/reports/constants.py b/packaging/setup/ovirt_engine_setup/reports/constants.py index 2cbbaac..9323c9c 100644 --- a/packaging/setup/ovirt_engine_setup/reports/constants.py +++ b/packaging/setup/ovirt_engine_setup/reports/constants.py @@ -1,6 +1,6 @@ # # ovirt-engine-setup -- ovirt engine setup -# Copyright (C) 2013-2014 Red Hat, Inc. +# Copyright (C) 2013-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. @@ -176,7 +176,7 @@ PKG_SYSCONF_DIR, 'sso.properties', ) - OVIRT_ENGINE_REPORTS_DB_BACKUP_DIR = os.path.join( + OVIRT_ENGINE_DEFAULT_REPORTS_DB_BACKUP_DIR = os.path.join( PKG_STATE_DIR, 'backups', ) @@ -411,6 +411,12 @@ def HEAP_MAX(self): return 'OVESETUP_REPORTS_CONFIG/heapMax' + @osetupattrs( + answerfile=True, + ) + def OVIRT_ENGINE_REPORTS_DB_BACKUP_DIR(self): + return 'OVESETUP_REPORTS_CONFIG/reportsDbBackupDir' + @util.export @util.codegen diff --git a/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-reports/db/__init__.py b/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-reports/db/__init__.py index 394062b..1cc2625 100644 --- a/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-reports/db/__init__.py +++ b/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-reports/db/__init__.py @@ -1,6 +1,6 @@ # # ovirt-engine-setup -- ovirt engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-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. @@ -21,12 +21,14 @@ from . import pgpass from . import connection +from . import config @util.export def createPlugins(context): pgpass.Plugin(context=context) connection.Plugin(context=context) + config.Plugin(context=context) # vim: expandtab tabstop=4 shiftwidth=4 diff --git a/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-reports/db/config.py b/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-reports/db/config.py new file mode 100644 index 0000000..5702e9b --- /dev/null +++ b/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-reports/db/config.py @@ -0,0 +1,47 @@ +# +# ovirt-engine-setup -- ovirt engine setup +# Copyright (C) 2013-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. +# + + +"""Config plugin.""" + + +from otopi import util +from otopi import plugin + + +from ovirt_engine_setup.reports import constants as oreportscons + + [email protected] +class Plugin(plugin.PluginBase): + """Config plugin.""" + + def __init__(self, context): + super(Plugin, self).__init__(context=context) + + @plugin.event( + stage=plugin.Stages.STAGE_INIT, + ) + def _init(self): + self.environment.setdefault( + oreportscons.ConfigEnv.OVIRT_ENGINE_REPORTS_DB_BACKUP_DIR, + oreportscons.FileLocations. + OVIRT_ENGINE_DEFAULT_REPORTS_DB_BACKUP_DIR + ) + + +# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-reports/db/clear.py b/packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-reports/db/clear.py index b6ad9a2..4d34100 100644 --- a/packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-reports/db/clear.py +++ b/packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-reports/db/clear.py @@ -1,6 +1,6 @@ # # ovirt-engine-setup -- ovirt engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-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. @@ -101,10 +101,9 @@ ) dbovirtutils.tryDatabaseConnect() self._bkpfile = dbovirtutils.backup( - dir=( - oreportscons.FileLocations. - OVIRT_ENGINE_REPORTS_DB_BACKUP_DIR - ), + dir=self.environment[ + oreportscons.ConfigEnv.OVIRT_ENGINE_REPORTS_DB_BACKUP_DIR + ], prefix=( oreportscons.Const. OVIRT_ENGINE_REPORTS_DB_BACKUP_PREFIX diff --git a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py index 91871f5..e8af3f5 100644 --- a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py +++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py @@ -1,6 +1,6 @@ # # ovirt-engine-setup -- ovirt engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-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. @@ -91,10 +91,10 @@ oreportscons.DBEnv.NEW_DATABASE ]: self._backup = self._dbovirtutils.backup( - dir=( - oreportscons.FileLocations. + dir=self.environment[ + oreportscons.ConfigEnv. OVIRT_ENGINE_REPORTS_DB_BACKUP_DIR - ), + ], prefix=( oreportscons.Const. OVIRT_ENGINE_REPORTS_DB_BACKUP_PREFIX -- To view, visit https://gerrit.ovirt.org/38253 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1526e84d389c464f4eddc4f56b0d8b27a92edf81 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-reports Gerrit-Branch: master Gerrit-Owner: Yedidyah Bar David <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
