Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: fix NULL user passwords on import
......................................................................

packaging: setup: fix NULL user passwords on import

Bug-Url: https://bugzilla.redhat.com/1049349
Change-Id: Ibc7202233439c9e632fe38b56fedabe841bf1223
Signed-off-by: Yedidyah Bar David <[email protected]>
---
M packaging/common_utils.py
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-reports refs/changes/69/23069/1

diff --git a/packaging/common_utils.py b/packaging/common_utils.py
index dc87fc9..b4636ec 100755
--- a/packaging/common_utils.py
+++ b/packaging/common_utils.py
@@ -15,6 +15,7 @@
 import tempfile
 import random
 import string
+import glob
 
 from StringIO import StringIO
 
@@ -653,6 +654,19 @@
     execExternalCmd(cmd, True, "Failed while importing reports")
     os.chdir(current_dir)
 
+def fixNullUserPasswords(tempDir):
+    logging.debug("fixNullUserPasswords started for %s" % tempDir)
+    fixedFiles = []
+    for f in glob.glob(tempDir + '/users/organization_1/*.xml'):
+        xmlObj = XMLConfigFileHandler(f)
+        xmlObj.open()
+        node = getXmlNode(xmlObj, '/user/password')
+        if node.getContent() == 'ENC<null>':
+            fixedFiles.append(f)
+            node.setContent('ENC<>')
+        xmlObj.close()
+    logging.debug("fixNullUserPasswords fixed: %s" % fixedFiles)
+
 @transactionDisplay("Exporting current users")
 def exportUsers():
     """
@@ -671,6 +685,7 @@
     logging.debug("Exporting users to %s" % tempDir)
     cmd = "./js-export.sh --output-dir %s --users --roles" % tempDir
     execExternalCmd(cmd, True, "Failed while exporting users")
+    fixNullUserPasswords(tempDir)
 
     os.chdir(current_dir)
     return tempDir


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc7202233439c9e632fe38b56fedabe841bf1223
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-reports
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to