[node-patches] Change in ovirt-node[master]: ovirtfunctions: Followup cleanups
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: Followup cleanups
......................................................................
ovirtfunctions: Followup cleanups
rhbz#866300
Change-Id: Iedc53f7dc338e35b8c239e81842d564e29bb4b25
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/ovirtnode/ovirtfunctions.py
1 file changed, 12 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/86/8586/1
diff --git a/scripts/ovirtnode/ovirtfunctions.py b/scripts/ovirtnode/ovirtfunctions.py
index 8a529b9..11295da 100644
--- a/scripts/ovirtnode/ovirtfunctions.py
+++ b/scripts/ovirtnode/ovirtfunctions.py
@@ -681,9 +681,10 @@
if os.path.isdir(filename):
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.")
+ logger.warn("You need to unpersist its child directories " +
+ "and/or files and try again.")
persist_it=False
- rc = 0
+ rc = True
# if it's a file then make sure it's not already persisted
if os.path.isfile(filename):
@@ -693,7 +694,7 @@
if md5root == md5stored:
logger.warn("File already persisted: " + filename)
persist_it=False
- rc = 0
+ rc = True
else:
# persistent copy needs refresh
if system("umount -n " + filename + " 2> /dev/null"):
@@ -707,22 +708,24 @@
dirname = os.path.dirname(filename)
system("mkdir -p /config/" + dirname)
if system("cp -a " + filename + " /config"+filename):
- if not system("mount -n --bind /config"+filename+ " "+filename):
+ if not system("mount -n --bind /config"+filename+ " " + \
+ filename):
logger.error("Failed to persist: " + filename)
- rc = 1
+ rc = False
else:
logger.info("File: " + filename + " persisted")
rc = True
# register in /config/files used by rc.sysinit
- ret = system_closefds("grep -q \"^$" + filename +"$\" /config/files 2> /dev/null")
+ 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 = 0
+ rc = True
else:
logger.warn(filename + " Already persisted")
- rc = 0
- if rc == 0:
+ rc = True
+ if rc:
return True
def is_persisted(filename):
--
To view, visit http://gerrit.ovirt.org/8586
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iedc53f7dc338e35b8c239e81842d564e29bb4b25
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