Backport #41907 for 2.6 - fix password lookup loading (#41928)

* Don't import password lookup from network filters. Fixes #41874 (#41907)

(cherry picked from commit 93537425a0)

* Add changelog for #41907
pull/41932/merge
Matt Martz 7 years ago committed by Matt Clay
parent cfb4a8236f
commit c15f99f95a

@ -0,0 +1,2 @@
bugfixes:
- password lookup - Do not load password lookup in network filters, allowing the password lookup to be overriden (https://github.com/ansible/ansible/pull/41907)

@ -28,11 +28,11 @@ import string
from collections import Mapping
from xml.etree.ElementTree import fromstring
from ansible.module_utils._text import to_text
from ansible.module_utils.network.common.utils import Template
from ansible.module_utils.six import iteritems, string_types
from ansible.errors import AnsibleError, AnsibleFilterError
from ansible.utils.encrypt import random_password
from ansible.plugins.lookup import password as ansible_password
try:
@ -362,7 +362,11 @@ def type5_pw(password, salt=None):
if not isinstance(password, string_types):
raise AnsibleFilterError("type5_pw password input should be a string, but was given a input of %s" % (type(password).__name__))
salt_chars = ansible_password._gen_candidate_chars(['ascii_letters', 'digits', './'])
salt_chars = u''.join((
to_text(string.ascii_letters),
to_text(string.digits),
u'./'
))
if salt is not None and not isinstance(salt, string_types):
raise AnsibleFilterError("type5_pw salt input should be a string, but was given a input of %s" % (type(salt).__name__))
elif not salt:

Loading…
Cancel
Save