From 6ad85298c4b33648340f0987256a07d8d650f4aa Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Fri, 5 Aug 2016 14:36:21 -0700 Subject: [PATCH] Simplify code by using mask_dict_password A patch to oslo.utils was done to make mask_dict_password() work like mask_password(). Using mask_dict_password() makes the code simpler and easier to understand. Change-Id: I3c34234eca11ff9d58ccdbbdc2d0114bdb6efebb --- ironic/api/controllers/v1/node.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ironic/api/controllers/v1/node.py b/ironic/api/controllers/v1/node.py index 6792340090..ca595f792e 100644 --- a/ironic/api/controllers/v1/node.py +++ b/ironic/api/controllers/v1/node.py @@ -13,7 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import ast import datetime from ironic_lib import metrics_utils @@ -802,9 +801,8 @@ class Node(base.APIBase): bookmark=True)] if not show_password and node.driver_info != wtypes.Unset: - node.driver_info = ast.literal_eval(strutils.mask_password( - node.driver_info, - "******")) + node.driver_info = strutils.mask_dict_password(node.driver_info, + "******") # NOTE(lucasagomes): The numeric ID should not be exposed to # the user, it's internal only.