Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: Use dwh_history_timekeeping from engine
......................................................................

packaging: setup: Use dwh_history_timekeeping from engine

This module was at first in dwh. Then we decided the engine needs it
too and copied it there. This change removes our copy and uses the one
in the engine.

Change-Id: I74b156b1941a7d48181b58ea6962fd02ab646fc8
Signed-off-by: Yedidyah Bar David <d...@redhat.com>
---
D packaging/setup/ovirt_engine_setup/dwh/engine_db_timekeeping.py
M packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-dwh/db/single_etl.py
M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/single_etl.py
3 files changed, 4 insertions(+), 76 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-dwh refs/changes/68/36068/1

diff --git a/packaging/setup/ovirt_engine_setup/dwh/engine_db_timekeeping.py 
b/packaging/setup/ovirt_engine_setup/dwh/engine_db_timekeeping.py
deleted file mode 100644
index b49f770..0000000
--- a/packaging/setup/ovirt_engine_setup/dwh/engine_db_timekeeping.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# ovirt-engine-setup -- ovirt engine setup
-# Copyright (C) 2014 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.
-#
-
-
-import gettext
-_ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-dwh')
-
-
-from otopi import util
-
-
-DB_KEY_RUNNING = 'DwhCurrentlyRunning'
-DB_KEY_HOSTNAME = 'dwhHostname'
-DB_KEY_UUID = 'dwhUuid'
-
-
-@util.export
-def getValueFromTimekeeping(statement, name, raise_if_empty=False):
-    result = statement.execute(
-        statement="""
-            select * from GetDwhHistoryTimekeepingByVarName(
-                %(name)s
-            )
-        """,
-        args=dict(
-            name=name,
-        ),
-        ownConnection=True,
-    )
-    if not result and raise_if_empty:
-        raise RuntimeError(
-            _(
-                'Missing row {name} in the table dwh_history_timekeeping '
-                'in the engine database'
-            ).format(
-                name=name,
-            )
-        )
-    return result[0]['var_value'] if result else None
-
-
-def updateValueInTimekeeping(statement, name, value):
-    getValueFromTimekeeping(statement, name, raise_if_empty=True)
-    statement.execute(
-        statement="""
-            select UpdateDwhHistoryTimekeeping(
-                %(name)s,
-                %(value)s,
-                NULL
-            )
-        """,
-        args=dict(
-            name=name,
-            value=value,
-        ),
-        ownConnection=False,
-    )
-
-
-# vim: expandtab tabstop=4 shiftwidth=4
diff --git 
a/packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-dwh/db/single_etl.py 
b/packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-dwh/db/single_etl.py
index 261af50..e7d0464 100644
--- 
a/packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-dwh/db/single_etl.py
+++ 
b/packaging/setup/plugins/ovirt-engine-remove/ovirt-engine-dwh/db/single_etl.py
@@ -25,7 +25,8 @@
 
 
 from ovirt_engine_setup.dwh import constants as odwhcons
-from ovirt_engine_setup.dwh import engine_db_timekeeping
+from ovirt_engine_setup.engine_common import dwh_history_timekeeping as \
+    engine_db_timekeeping
 
 
 @util.export
diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/single_etl.py
 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/single_etl.py
index 4400388..8096811 100644
--- 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/single_etl.py
+++ 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-dwh/core/single_etl.py
@@ -29,7 +29,8 @@
 from ovirt_engine_setup import constants as osetupcons
 from ovirt_engine_setup import dialog
 from ovirt_engine_setup.dwh import constants as odwhcons
-from ovirt_engine_setup.dwh import engine_db_timekeeping
+from ovirt_engine_setup.engine_common import dwh_history_timekeeping as \
+    engine_db_timekeeping
 from ovirt_engine_setup.engine_common import database
 
 


-- 
To view, visit http://gerrit.ovirt.org/36068
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I74b156b1941a7d48181b58ea6962fd02ab646fc8
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-dwh
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <d...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to