mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
Migrate basestring to a python3 compatible type (#17199)
This commit is contained in:
parent
a695e18615
commit
a22909c226
28 changed files with 137 additions and 101 deletions
|
@ -17,6 +17,7 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.six import string_types
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
from ansible.utils.listify import listify_lookup_plugin_terms
|
||||
|
@ -41,7 +42,7 @@ class LookupModule(LookupBase):
|
|||
_raise_terms_error()
|
||||
|
||||
# first term should be a list (or dict), second a string holding the subkey
|
||||
if not isinstance(terms[0], (list, dict)) or not isinstance(terms[1], basestring):
|
||||
if not isinstance(terms[0], (list, dict)) or not isinstance(terms[1], string_types):
|
||||
_raise_terms_error("first a dict or a list, second a string pointing to the subkey")
|
||||
subelements = terms[1].split(".")
|
||||
|
||||
|
@ -59,7 +60,7 @@ class LookupModule(LookupBase):
|
|||
flags = {}
|
||||
if len(terms) == 3:
|
||||
flags = terms[2]
|
||||
if not isinstance(flags, dict) and not all([isinstance(key, basestring) and key in FLAGS for key in flags]):
|
||||
if not isinstance(flags, dict) and not all([isinstance(key, string_types) and key in FLAGS for key in flags]):
|
||||
_raise_terms_error("the optional third item must be a dict with flags %s" % FLAGS)
|
||||
|
||||
# build_items
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue