Fix malformed string error for hashed_password (#51007)

* Fix malformed string error using ast

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

* Update doc for this option

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

* Revert "Update doc for this option"

This reverts commit 3579d19121.

* Revert type value

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
This commit is contained in:
Nilashish Chakraborty 2019-01-17 13:05:49 +05:30 committed by GitHub
parent 3dc5ba6186
commit 422604fb3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -213,7 +213,6 @@ commands:
from copy import deepcopy from copy import deepcopy
import re import re
import ast
import base64 import base64
import hashlib import hashlib
@ -269,8 +268,8 @@ def map_obj_to_commands(updates, module):
command.append('username %s %s' % (want['name'], x)) command.append('username %s %s' % (want['name'], x))
def add_hashed_password(command, want, x): def add_hashed_password(command, want, x):
command.append('username %s secret %s %s' % (want['name'], ast.literal_eval(x)['type'], command.append('username %s secret %s %s' % (want['name'], x.get('type'),
ast.literal_eval(x)['value'])) x.get('value')))
def add_ssh(command, want, x=None): def add_ssh(command, want, x=None):
command.append('ip ssh pubkey-chain') command.append('ip ssh pubkey-chain')