mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
Python 3: there's no basestring
Fixes one failing test. The long series of module_utils/basic.py fixes were all because module_utils/basic is imported in ansible/inventory/script.py.
This commit is contained in:
parent
2c4982b58d
commit
95e655eb67
1 changed files with 4 additions and 2 deletions
|
@ -26,6 +26,8 @@ import re
|
||||||
import stat
|
import stat
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
|
from six import string_types
|
||||||
|
|
||||||
from ansible import constants as C
|
from ansible import constants as C
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
|
|
||||||
|
@ -78,7 +80,7 @@ class Inventory(object):
|
||||||
|
|
||||||
def parse_inventory(self, host_list):
|
def parse_inventory(self, host_list):
|
||||||
|
|
||||||
if isinstance(host_list, basestring):
|
if isinstance(host_list, string_types):
|
||||||
if "," in host_list:
|
if "," in host_list:
|
||||||
host_list = host_list.split(",")
|
host_list = host_list.split(",")
|
||||||
host_list = [ h for h in host_list if h and h.strip() ]
|
host_list = [ h for h in host_list if h and h.strip() ]
|
||||||
|
@ -589,7 +591,7 @@ class Inventory(object):
|
||||||
|
|
||||||
def is_file(self):
|
def is_file(self):
|
||||||
""" did inventory come from a file? """
|
""" did inventory come from a file? """
|
||||||
if not isinstance(self.host_list, basestring):
|
if not isinstance(self.host_list, string_types):
|
||||||
return False
|
return False
|
||||||
return self._loader.path_exists(self.host_list)
|
return self._loader.path_exists(self.host_list)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue