[node-patches] Change in ovirt-node[master]: ovirtfunctions: Silence ovirt_store_config

fabiand at fedoraproject.org fabiand at fedoraproject.org
Mon Oct 15 18:55:16 UTC 2012


Fabian Deutsch has uploaded a new change for review.

Change subject: ovirtfunctions: Silence ovirt_store_config
......................................................................

ovirtfunctions: Silence ovirt_store_config

This needed some logic changes.

rhbz#866299

Change-Id: I67484f5a522286027c105e4e7cdc62fce34e7130
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/ovirtnode/ovirtfunctions.py
1 file changed, 16 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/87/8587/1

diff --git a/scripts/ovirtnode/ovirtfunctions.py b/scripts/ovirtnode/ovirtfunctions.py
index 11295da..0a27eeb 100644
--- a/scripts/ovirtnode/ovirtfunctions.py
+++ b/scripts/ovirtnode/ovirtfunctions.py
@@ -676,33 +676,34 @@
     for f in files_list:
         filename = os.path.abspath(f)
         persist_it=True
-        # ensure that, if this is a directory
-        # that it's not already persisted
+
         if os.path.isdir(filename):
+            # ensure that, if this is a directory
+            # that it's not already persisted
             if os.path.isdir("/config/" + filename):
                 logger.warn("Directory already persisted: " + filename)
                 logger.warn("You need to unpersist its child directories " +
                             "and/or files and try again.")
                 persist_it=False
-                rc = True
-
-        # if it's a file then make sure it's not already persisted
-        if os.path.isfile(filename):
+        elif os.path.isfile(filename):
+            # if it's a file then make sure it's not already persisted
             if os.path.isfile("/config/" + filename):
                 md5root=md5sum(filename)
                 md5stored=md5sum("/config" + filename)
                 if md5root == md5stored:
                     logger.warn("File already persisted: " + filename)
                     persist_it=False
-                    rc = True
                 else:
                     # persistent copy needs refresh
                     if system("umount -n " + filename + " 2> /dev/null"):
                         system("rm -f /config"+ filename)
-        if persist_it:
+        else:
             # skip if file does not exist
-            if not os.path.exists(filename):
-                logger.warn("Skipping, file: " + filename + " does not exist")
+            logger.warn("Skipping, file '" + filename + "' does not exist")
+            continue
+
+        rc = True
+        if persist_it:
             # skip if already bind-mounted
             if not check_bind_mount(filename):
                 dirname = os.path.dirname(filename)
@@ -714,19 +715,19 @@
                         rc = False
                     else:
                         logger.info("File: " + filename + " persisted")
-                        rc = True
+                        rc = rc and True
             # register in /config/files used by rc.sysinit
             ret = system_closefds("grep -q \"^$" + filename +"$\" " + \
                                   " /config/files 2> /dev/null")
             if ret > 0:
                 system_closefds("echo "+filename+" >> /config/files")
                 logger.info("Successfully persisted: " + filename)
-                rc = True
+                rc = rc and True
         else:
             logger.warn(filename + " Already persisted")
-            rc = True
-    if rc:
-        return True
+            rc = rc and True
+    return rc
+
 
 def is_persisted(filename):
     abspath = os.path.abspath(filename)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I67484f5a522286027c105e4e7cdc62fce34e7130
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list