Alon Bar-Lev has uploaded a new change for review.

Change subject: packaging: engine-service: move generated code out of main 
source
......................................................................

packaging: engine-service: move generated code out of main source

this ease maintenance, as main source is regular script.

Change-Id: I1b55fbb7d9ad3513c429b190379825aa5a91c13a
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M .gitignore
M Makefile
A packaging/services/__init__.py
A packaging/services/config.py.in
R packaging/services/engine-service.py
5 files changed, 50 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/53/14153/1

diff --git a/.gitignore b/.gitignore
index 112219c..487f844 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,7 +47,7 @@
 backend/manager/tools/src/main/conf/engine-config-log4j.xml
 backend/manager/tools/src/main/conf/engine-manage-domains-log4j.xml
 backend/manager/tools/src/main/conf/engine-notifier-log4j.xml
-packaging/services/engine-service.py
+packaging/services/config.py
 packaging/services/engine-service.systemd
 packaging/services/engine-service.sysv
 packaging/fedora/spec/ovirt-engine.spec
diff --git a/Makefile b/Makefile
index 0c52ed1..6e4b77a 100644
--- a/Makefile
+++ b/Makefile
@@ -123,7 +123,7 @@
        backend/manager/tools/src/main/conf/engine-config-log4j.xml \
        backend/manager/tools/src/main/conf/engine-manage-domains-log4j.xml \
        backend/manager/tools/src/main/conf/engine-notifier-log4j.xml \
-       packaging/services/engine-service.py \
+       packaging/services/config.py \
        packaging/services/engine-service.systemd \
        packaging/services/engine-service.sysv \
        packaging/fedora/spec/ovirt-engine.spec \
@@ -136,7 +136,6 @@
 
 generated-files:       $(GENERATED)
        chmod a+x packaging/services/engine-service.sysv
-       chmod a+x packaging/services/engine-service.py
 
 $(BUILD_FILE):
        -[ "$(MAVEN_OUTPUT_DIR_DEFAULT)" = "$(MAVEN_OUTPUT_DIR)" ] && rm -fr 
"$(MAVEN_OUTPUT_DIR)"
@@ -416,6 +415,8 @@
 
        # Install the files:
        install -dm 755 $(DESTDIR)$(DATA_DIR)/services
+       install -m 644 packaging/services/__init__.py 
$(DESTDIR)$(DATA_DIR)/services
+       install -m 644 packaging/services/config.py 
$(DESTDIR)$(DATA_DIR)/services
        install -m 644 packaging/services/engine-service.xml.in 
$(DESTDIR)$(DATA_DIR)/services
        install -m 644 packaging/services/engine-service-logging.properties.in 
$(DESTDIR)$(DATA_DIR)/services
        install -m 755 packaging/services/engine-service.py 
$(DESTDIR)$(DATA_DIR)/services
diff --git a/packaging/services/__init__.py b/packaging/services/__init__.py
new file mode 100644
index 0000000..aa5eb8e
--- /dev/null
+++ b/packaging/services/__init__.py
@@ -0,0 +1,19 @@
+# Copyright 2012 Red Hat
+#
+# 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.
+
+
+__all__ = []
+
+
+# vim: expandtab tabstop=4 shiftwidth=4
diff --git a/packaging/services/config.py.in b/packaging/services/config.py.in
new file mode 100644
index 0000000..45df68b
--- /dev/null
+++ b/packaging/services/config.py.in
@@ -0,0 +1,20 @@
+# Copyright 2012 Red Hat
+#
+# 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.
+
+
+ENGINE_DEFAULT_FILE = '@ENGINE_DEFAULTS@'
+ENGINE_VARS = '@ENGINE_VARS@'
+
+
+# vim: expandtab tabstop=4 shiftwidth=4
diff --git a/packaging/services/engine-service.py.in 
b/packaging/services/engine-service.py
similarity index 98%
rename from packaging/services/engine-service.py.in
rename to packaging/services/engine-service.py
old mode 100644
new mode 100755
index d4aa6dc..5f150b0
--- a/packaging/services/engine-service.py.in
+++ b/packaging/services/engine-service.py
@@ -34,9 +34,7 @@
 from Cheetah.Template import Template
 
 
-class Config(object):
-    ENGINE_DEFAULT_FILE = '@ENGINE_DEFAULTS@'
-    ENGINE_VARS = '@ENGINE_VARS@'
+import config
 
 
 class Base(object):
@@ -251,20 +249,20 @@
         super(EngineDaemon, self).__init__()
 
     def _loadConfig(self):
-        if not os.path.exists(Config.ENGINE_DEFAULT_FILE):
+        if not os.path.exists(config.ENGINE_DEFAULT_FILE):
             raise RuntimeError(
                 _(
                     "The engine configuration defaults file '{file}' "
                     "required but missing"
                 ).format(
-                    file=Config.ENGINE_DEFAULT_FILE,
+                    file=config.ENGINE_DEFAULT_FILE,
                 )
             )
 
         self._config = ConfigFile(
             (
-                Config.ENGINE_DEFAULT_FILE,
-                Config.ENGINE_VARS,
+                config.ENGINE_DEFAULT_FILE,
+                config.ENGINE_VARS,
             ),
         )
 
@@ -817,8 +815,8 @@
                 'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin',
                 'LANG': 'en_US.UTF-8',
                 'LC_ALL': 'en_US.UTF-8',
-                'ENGINE_DEFAULTS': Config.ENGINE_DEFAULT_FILE,
-                'ENGINE_VARS': Config.ENGINE_VARS,
+                'ENGINE_DEFAULTS': config.ENGINE_DEFAULT_FILE,
+                'ENGINE_VARS': config.ENGINE_VARS,
                 'ENGINE_ETC': self._config.getString('ENGINE_ETC'),
                 'ENGINE_LOG': self._config.getString('ENGINE_LOG'),
                 'ENGINE_TMP': self._config.getString('ENGINE_TMP'),


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b55fbb7d9ad3513c429b190379825aa5a91c13a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to