Bugfix for aggregate function in junos_user module (#62833)

* Update junos_user.py (#60459)

(cherry picked from commit c226c1015e)

* changelog fragment for junos_user bugfix
pull/64281/head
kr3ator 5 years ago committed by Toshio Kuratomi
parent d68a05414a
commit 91eacc0f2b

@ -0,0 +1,2 @@
bugfixes:
- junos_user - fixed issue with adding multiple values for a Junos account with aggregate mode

@ -224,8 +224,7 @@ def map_obj_to_ele(module, want):
SubElement(user, 'full-name').text = item['full_name'] SubElement(user, 'full-name').text = item['full_name']
if item.get('sshkey'): if item.get('sshkey'):
if 'auth' not in locals(): auth = SubElement(user, 'authentication')
auth = SubElement(user, 'authentication')
if 'ssh-rsa' in item['sshkey']: if 'ssh-rsa' in item['sshkey']:
ssh_rsa = SubElement(auth, 'ssh-rsa') ssh_rsa = SubElement(auth, 'ssh-rsa')
elif 'ssh-dss' in item['sshkey']: elif 'ssh-dss' in item['sshkey']:
@ -237,8 +236,7 @@ def map_obj_to_ele(module, want):
key = SubElement(ssh_rsa, 'name').text = item['sshkey'] key = SubElement(ssh_rsa, 'name').text = item['sshkey']
if item.get('encrypted_password'): if item.get('encrypted_password'):
if 'auth' not in locals(): auth = SubElement(user, 'authentication')
auth = SubElement(user, 'authentication')
SubElement(auth, 'encrypted-password').text = item['encrypted_password'] SubElement(auth, 'encrypted-password').text = item['encrypted_password']
return element return element

Loading…
Cancel
Save