[node-patches] Change in ovirt-node[master]: ovirtfunctions: Add validations to remove files or dirs

dougsland at redhat.com dougsland at redhat.com
Fri Dec 19 16:01:48 UTC 2014


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: ovirtfunctions: Add validations to remove files or dirs
......................................................................

ovirtfunctions: Add validations to remove files or dirs

This patch adds additional validation before removing a file or
dir in ovirt_safe_delete_config.

Change-Id: I079a89e4148467fba67257143b1191aa1e1363e6
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M src/ovirtnode/ovirtfunctions.py
1 file changed, 11 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/06/36306/1

diff --git a/src/ovirtnode/ovirtfunctions.py b/src/ovirtnode/ovirtfunctions.py
index 8ab7b12..0f18c08 100644
--- a/src/ovirtnode/ovirtfunctions.py
+++ b/src/ovirtnode/ovirtfunctions.py
@@ -1088,11 +1088,18 @@
             output, err = ls_cmd.communicate()
             for child in output:
                 ovirt_safe_delete_config(child)
-            system("rm -rf /config'%s'" % filename)
-            system("rm -rf '%s'" % filename)
+
+            if os.path.exists("/config" + filename):
+                system("rm -rf /config'%s'" % filename)
+
+            if os.path.exists(filename):
+                system("rm -rf '%s'" % filename)
         else:
-            system("shred -u /config'%s'" % filename)
-            system("shred -u '%s'" % filename)
+            if os.path.exists("/config" + filename):
+                system("shred -u /config'%s'" % filename)
+
+            if os.path.exists(filename):
+                system("shred -u '%s'" % filename)
 
 
 # compat function to handle different udev versions


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I079a89e4148467fba67257143b1191aa1e1363e6
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