[node-patches] Change in ovirt-node[master]: hooks: ignore non pyc files during autoinstall

dougsland at redhat.com dougsland at redhat.com
Thu Aug 7 01:21:40 UTC 2014


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: hooks: ignore non pyc files during autoinstall
......................................................................

hooks: ignore non pyc files during autoinstall

Generating an image without image-minimizer.ks the .py an
.pyo files will remain in the ISO.
However, the current hook logic is check if the hook file is .py
and execute it calling with python binary or execute the script
directly. Based in that assumption, .pyc and .pyo will be called
as script and will make the autoinstall fail.
This patch, removes the duplicate code around this logic and
will ignore .py and .pyo files, executing only .pyc or any other
hook script.

Change-Id: I8c87a3db450ac4c4172c5540f7552c0e03d90066
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M src/ovirt/node/utils/hooks.py
1 file changed, 8 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/73/31173/1

diff --git a/src/ovirt/node/utils/hooks.py b/src/ovirt/node/utils/hooks.py
index 3318686..b9563ce 100644
--- a/src/ovirt/node/utils/hooks.py
+++ b/src/ovirt/node/utils/hooks.py
@@ -60,14 +60,15 @@
     def __run(hooks_directory):
         for hook in os.listdir(hooks_directory):
             script = os.path.join(hooks_directory, hook)
-            if script.endswith(".py"):
-                LOGGER.debug("Running hook %s" % script)
+
+            if script.endswith(".py") or script.endswith(".pyo"):
+                continue
+
+            LOGGER.debug("Running hook %s" % script)
+            if script.endswith(".pyc"):
                 output = process.check_output(["python", script])
-                [LOGGER.debug("%s: %s" % (script, line)) for line in
-                    output]
             else:
-                LOGGER.debug("Running hook %s" % script)
                 output = process.check_output("%s &> /dev/null" % script,
                                               shell=True)
-                [LOGGER.debug("%s: %s" % (script, line)) for line in
-                    output]
+
+            [LOGGER.debug("%s: %s" % (script, line)) for line in output]


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8c87a3db450ac4c4172c5540f7552c0e03d90066
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>



More information about the node-patches mailing list