[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fedora-directory-commits
Subject:    =?utf-8?q?=5B389-commits=5D?= [389-ds-base] branch 389-ds-base-1.4.0 updated: Issue 50634 - Fix CLI 
From:       pagure () pagure ! io
Date:       2019-11-14 18:59:40
Message-ID: 20191114185940.25604.50882 () pagure01 ! fedoraproject ! org
[Download RAW message or body]

This is an automated email from the git hooks/post-receive script.

spichugi pushed a commit to branch 389-ds-base-1.4.0
in repository 389-ds-base.

The following commit(s) were added to refs/heads/389-ds-base-1.4.0 by this push:
     new 994a109  Issue 50634 - Fix CLI error parsing for non-string values
994a109 is described below

commit 994a109883405bd0eec1ce378e9c424240e46510
Author: Simon Pichugin <spichugi@redhat.com>
AuthorDate: Thu Nov 14 17:24:00 2019 +0100

    Issue 50634 - Fix CLI error parsing for non-string values
    
    Bug Description: Sometimes the error message has int values and
    it makes ' - '.join() function to fail.
    
    Fix Description: Use a list comprehension to change the dict values to str.
    
    https://pagure.io/389-ds-base/issue/50634
    
    Reviewed by: ?
---
 src/lib389/cli/dsconf                  | 2 +-
 src/lib389/cli/dscreate                | 2 +-
 src/lib389/cli/dsctl                   | 2 +-
 src/lib389/cli/dsidm                   | 2 +-
 src/lib389/lib389/cli_base/__init__.py | 2 ++
 5 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/lib389/cli/dsconf b/src/lib389/cli/dsconf
index 2059a06..6e3ef19 100755
--- a/src/lib389/cli/dsconf
+++ b/src/lib389/cli/dsconf
@@ -143,7 +143,7 @@ if __name__ == '__main__':
         if args and args.json:
             sys.stderr.write(json.dumps(msg))
         else:
-            log.error("Error: %s" % " - ".join(msg.values()))
+            log.error("Error: %s" % " - ".join(str(val) for val in msg.values()))
         result = False
 
     disconnect_instance(inst)
diff --git a/src/lib389/cli/dscreate b/src/lib389/cli/dscreate
index b516eb9..b9c5b48 100755
--- a/src/lib389/cli/dscreate
+++ b/src/lib389/cli/dscreate
@@ -76,7 +76,7 @@ if __name__ == '__main__':
     except Exception as e:
         log.debug(e, exc_info=True)
         msg = format_error_to_dict(e)
-        log.error("Error: %s" % " - ".join(msg.values()))
+        log.error("Error: %s" % " - ".join(str(val) for val in msg.values()))
         result = False
 
     # Done!
diff --git a/src/lib389/cli/dsctl b/src/lib389/cli/dsctl
index 3be9540..9bca1e9 100755
--- a/src/lib389/cli/dsctl
+++ b/src/lib389/cli/dsctl
@@ -127,7 +127,7 @@ if __name__ == '__main__':
     except Exception as e:
         log.debug(e, exc_info=True)
         msg = format_error_to_dict(e)
-        log.error("Error: %s" % " - ".join(msg.values()))
+        log.error("Error: %s" % " - ".join(str(val) for val in msg.values()))
         result = False
     disconnect_instance(inst)
 
diff --git a/src/lib389/cli/dsidm b/src/lib389/cli/dsidm
index da246b5..fb0b6a2 100755
--- a/src/lib389/cli/dsidm
+++ b/src/lib389/cli/dsidm
@@ -133,7 +133,7 @@ if __name__ == '__main__':
     except Exception as e:
         log.debug(e, exc_info=True)
         msg = format_error_to_dict(e)
-        log.error("Error: %s" % " - ".join(msg.values()))
+        log.error("Error: %s" % " - ".join(str(val) for val in msg.values()))
         result = False
 
     disconnect_instance(inst)
diff --git a/src/lib389/lib389/cli_base/__init__.py b/src/lib389/lib389/cli_base/__init__.py
index 12b1c51..e2e6c90 100644
--- a/src/lib389/lib389/cli_base/__init__.py
+++ b/src/lib389/lib389/cli_base/__init__.py
@@ -422,6 +422,8 @@ def format_error_to_dict(exception):
     # We should fix the code here after the issue is fixed
     errmsg = str(exception)
     try:
+        # The function literal_eval parses the string and returns only if it's a literal.
+        # Also, the code is never executed. So there is no reason for a security risk.
         msg = ast.literal_eval(errmsg)
     except Exception:
         msg = {'desc': errmsg}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
389-commits mailing list -- 389-commits@lists.fedoraproject.org
To unsubscribe send an email to 389-commits-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/389-commits@lists.fedoraproject.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic