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

pull/41965/head
Matt Martz 7 years ago committed by GitHub
parent 1a2ef0922f
commit 93537425a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,11 +28,11 @@ import string
from collections import Mapping from collections import Mapping
from xml.etree.ElementTree import fromstring 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.network.common.utils import Template
from ansible.module_utils.six import iteritems, string_types from ansible.module_utils.six import iteritems, string_types
from ansible.errors import AnsibleError, AnsibleFilterError from ansible.errors import AnsibleError, AnsibleFilterError
from ansible.utils.encrypt import random_password from ansible.utils.encrypt import random_password
from ansible.plugins.lookup import password as ansible_password
try: try:
@ -362,7 +362,11 @@ def type5_pw(password, salt=None):
if not isinstance(password, string_types): 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__)) 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): 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__)) raise AnsibleFilterError("type5_pw salt input should be a string, but was given a input of %s" % (type(salt).__name__))
elif not salt: elif not salt:

Loading…
Cancel
Save