From 422604fb3e19b6dc3dce8b943d1f5a3b937a3ac7 Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Thu, 17 Jan 2019 13:05:49 +0530 Subject: [PATCH] Fix malformed string error for hashed_password (#51007) * Fix malformed string error using ast Signed-off-by: NilashishC * Update doc for this option Signed-off-by: NilashishC * Revert "Update doc for this option" This reverts commit 3579d1912129ab14d5009785ba896de820063d46. * Revert type value Signed-off-by: NilashishC --- lib/ansible/modules/network/ios/ios_user.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/network/ios/ios_user.py b/lib/ansible/modules/network/ios/ios_user.py index 8d675ac8d5..9969dc5652 100644 --- a/lib/ansible/modules/network/ios/ios_user.py +++ b/lib/ansible/modules/network/ios/ios_user.py @@ -213,7 +213,6 @@ commands: from copy import deepcopy import re -import ast import base64 import hashlib @@ -269,8 +268,8 @@ def map_obj_to_commands(updates, module): command.append('username %s %s' % (want['name'], x)) def add_hashed_password(command, want, x): - command.append('username %s secret %s %s' % (want['name'], ast.literal_eval(x)['type'], - ast.literal_eval(x)['value'])) + command.append('username %s secret %s %s' % (want['name'], x.get('type'), + x.get('value'))) def add_ssh(command, want, x=None): command.append('ip ssh pubkey-chain')