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: I7034de94b57b67fa39130e7983425f8186ebb347 Bug-Url: https://bugzilla.redhat.com/1110919 Signed-off-by: Yedidyah Bar David <[email protected]> --- M packaging/setup/ovirt_engine_setup/dwh/constants.py M packaging/setup/plugins/ovirt-engine-common/ovirt-engine-dwh/db/__init__.py A packaging/setup/plugins/ovirt-engine-common/ovirt-engine-dwh/db/config.py M packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-dwh/db/clear.py M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/db/schema.py 5 files changed, 68 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-dwh refs/changes/52/38252/1 diff --git a/packaging/setup/ovirt_engine_setup/dwh/constants.py b/packaging/setup/ovirt_engine_setup/dwh/constants.py index d6de510..c5da76e 100644 --- a/packaging/setup/ovirt_engine_setup/dwh/constants.py +++ b/packaging/setup/ovirt_engine_setup/dwh/constants.py @@ -144,7 +144,7 @@ OVIRT_ENGINE_DWH_DB_DIR, 'schema.sh', ) - OVIRT_ENGINE_DWH_DB_BACKUP_DIR = os.path.join( + OVIRT_ENGINE_DEFAULT_DWH_DB_BACKUP_DIR = os.path.join( PKG_STATE_DIR, 'backups', ) @@ -196,6 +196,18 @@ @util.export @util.codegen @osetupattrsclass +class ConfigEnv(object): + + @osetupattrs( + answerfile=True, + ) + def OVIRT_ENGINE_DWH_DB_BACKUP_DIR(self): + return 'OVESETUP_DWH_CONFIG/dwhDbBackupDir' + + [email protected] [email protected] +@osetupattrsclass class DBEnv(object): @osetupattrs( diff --git a/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-dwh/db/__init__.py b/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-dwh/db/__init__.py index 14cafab..6da75f1 100644 --- a/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-dwh/db/__init__.py +++ b/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-dwh/db/__init__.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. @@ -21,6 +21,7 @@ from . import pgpass from . import connection +from . import config from . import engine_connection @@ -28,6 +29,7 @@ def createPlugins(context): pgpass.Plugin(context=context) connection.Plugin(context=context) + config.Plugin(context=context) engine_connection.Plugin(context=context) diff --git a/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-dwh/db/config.py b/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-dwh/db/config.py new file mode 100644 index 0000000..8f8e287 --- /dev/null +++ b/packaging/setup/plugins/ovirt-engine-common/ovirt-engine-dwh/db/config.py @@ -0,0 +1,46 @@ +# +# 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. +# + + +"""Config plugin.""" + + +from otopi import util +from otopi import plugin + + +from ovirt_engine_setup.dwh import constants as odwhcons + + [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( + odwhcons.ConfigEnv.OVIRT_ENGINE_DWH_DB_BACKUP_DIR, + odwhcons.FileLocations.OVIRT_ENGINE_DEFAULT_DWH_DB_BACKUP_DIR + ) + + +# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-dwh/db/clear.py b/packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-dwh/db/clear.py index 0e45072..8b808ee 100644 --- a/packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-dwh/db/clear.py +++ b/packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-dwh/db/clear.py @@ -101,7 +101,9 @@ ) dbovirtutils.tryDatabaseConnect() self._bkpfile = dbovirtutils.backup( - dir=odwhcons.FileLocations.OVIRT_ENGINE_DWH_DB_BACKUP_DIR, + dir=self.environment[ + odwhcons.ConfigEnv.OVIRT_ENGINE_DWH_DB_BACKUP_DIR + ], prefix=odwhcons.Const.OVIRT_ENGINE_DWH_DB_BACKUP_PREFIX, ) self.logger.info( diff --git a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/db/schema.py b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/db/schema.py index a776086..bf6c347 100644 --- a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/db/schema.py +++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/db/schema.py @@ -311,7 +311,9 @@ dbenvkeys=odwhcons.Const.DWH_DB_ENV_KEYS, ) self._backup = dbovirtutils.backup( - dir=odwhcons.FileLocations.OVIRT_ENGINE_DWH_DB_BACKUP_DIR, + dir=self.environment[ + odwhcons.ConfigEnv.OVIRT_ENGINE_DWH_DB_BACKUP_DIR + ], prefix=odwhcons.Const.OVIRT_ENGINE_DWH_DB_BACKUP_PREFIX, ) -- To view, visit https://gerrit.ovirt.org/38252 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7034de94b57b67fa39130e7983425f8186ebb347 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-dwh Gerrit-Branch: master Gerrit-Owner: Yedidyah Bar David <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
