summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkr3ator <48438188+kr3ator@users.noreply.github.com>2019-10-12 17:41:21 +0200
committerToshio Kuratomi <a.badger@gmail.com>2019-10-12 09:17:09 -0700
commitdff3fb58d7ef845fedcf4c7d9fe12f6713405176 (patch)
tree5c83d3a1f7f240958d7a15aa3e60f40a85e720f5
parent69021da05300671bb368c608a99a662f2ed1023c (diff)
downloadansible-dff3fb58d7ef845fedcf4c7d9fe12f6713405176.tar.gz
Bugfix for aggregate function in junos_user module (#62833)
* Update junos_user.py (#60459) (cherry picked from commit c226c1015e7bc353aeefdf76b5cb19fbbfae0d75) * changelog fragment for junos_user bugfix
-rw-r--r--changelogs/fragments/58978-junos_user-fix-ssh-key-assignment.yaml2
-rw-r--r--lib/ansible/modules/network/junos/junos_user.py6
2 files changed, 4 insertions, 4 deletions
diff --git a/changelogs/fragments/58978-junos_user-fix-ssh-key-assignment.yaml b/changelogs/fragments/58978-junos_user-fix-ssh-key-assignment.yaml
new file mode 100644
index 0000000000..03c9fab63f
--- /dev/null
+++ b/changelogs/fragments/58978-junos_user-fix-ssh-key-assignment.yaml
@@ -0,0 +1,2 @@
+bugfixes:
+ - junos_user - fixed issue with adding multiple values for a Junos account with aggregate mode \ No newline at end of file
diff --git a/lib/ansible/modules/network/junos/junos_user.py b/lib/ansible/modules/network/junos/junos_user.py
index 1c9c3ed2ac..697cbc4af6 100644
--- a/lib/ansible/modules/network/junos/junos_user.py
+++ b/lib/ansible/modules/network/junos/junos_user.py
@@ -224,8 +224,7 @@ def map_obj_to_ele(module, want):
SubElement(user, 'full-name').text = item['full_name']
if item.get('sshkey'):
- if 'auth' not in locals():
- auth = SubElement(user, 'authentication')
+ auth = SubElement(user, 'authentication')
if 'ssh-rsa' in item['sshkey']:
ssh_rsa = SubElement(auth, 'ssh-rsa')
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']
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']
return element