[node-patches] Change in ovirt-node[master]: Fix ovirt-node covers the orginal /etc/profile file when con...

hadong0720 at gmail.com hadong0720 at gmail.com
Tue Jul 9 07:05:29 UTC 2013


hadong has uploaded a new change for review.

Change subject: Fix ovirt-node covers the orginal /etc/profile file when configuring AES-NI
......................................................................

Fix ovirt-node covers the orginal /etc/profile file
when configuring AES-NI

Change-Id: If0c424136b5abe794c720d4dc33cda6c72b59b1d
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=982445
Signed-off-by: hadong <hadong0720 at gmail.com>
---
M src/ovirt/node/utils/fs.py
M src/ovirt/node/utils/security.py
2 files changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/97/16597/1

diff --git a/src/ovirt/node/utils/fs.py b/src/ovirt/node/utils/fs.py
index abb678b..c319641 100644
--- a/src/ovirt/node/utils/fs.py
+++ b/src/ovirt/node/utils/fs.py
@@ -54,12 +54,12 @@
             dstf.write(srcf.read())
 
 
-def atomic_write(filename, contents):
+def atomic_write(filename, contents, mode):
     backup = BackupedFiles([filename], ".temp")
     backup.create()
     backup_filename = backup.of(filename)
 
-    with open(backup_filename, "wb") as dst:
+    with open(backup_filename, mode) as dst:
         dst.write(contents)
 
     fns = (backup_filename, filename)
@@ -97,7 +97,7 @@
         """Write the contents of a file
         """
         try:
-            atomic_write(self.filename, contents)
+            atomic_write(self.filename, contents, mode)
         except:
             with open(self.filename, mode) as dst:
                 dst.write(contents)
diff --git a/src/ovirt/node/utils/security.py b/src/ovirt/node/utils/security.py
index 629521f..f596298 100644
--- a/src/ovirt/node/utils/security.py
+++ b/src/ovirt/node/utils/security.py
@@ -132,6 +132,8 @@
         rng, aes = ofunc.rng_status()
         if valid.Number(bounds=[0, None]).validate(num_bytes):
             self.__update_profile(num_bytes, aes)
+        elif num_bytes == "":
+            self.__update_profile(num_bytes, aes)
         elif num_bytes is None:
             pass
         else:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If0c424136b5abe794c720d4dc33cda6c72b59b1d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: hadong <hadong0720 at gmail.com>



More information about the node-patches mailing list