mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Merge pull request #12502 from mgedmin/py3k
Python 3: make test_variable_manager_precedence pass
This commit is contained in:
@@ -38,6 +38,12 @@ class Host:
|
||||
def __eq__(self, other):
|
||||
return self.name == other.name
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
||||
def __hash__(self):
|
||||
return hash(self.name)
|
||||
|
||||
def serialize(self):
|
||||
groups = []
|
||||
for group in self.groups:
|
||||
|
||||
@@ -20,7 +20,6 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import ast
|
||||
import shlex
|
||||
import re
|
||||
|
||||
from ansible import constants as C
|
||||
@@ -30,7 +29,8 @@ from ansible.inventory.group import Group
|
||||
from ansible.inventory.expand_hosts import detect_range
|
||||
from ansible.inventory.expand_hosts import expand_hostname_range
|
||||
from ansible.parsing.utils.addresses import parse_address
|
||||
from ansible.utils.unicode import to_unicode, to_bytes
|
||||
from ansible.utils.shlex import shlex_split
|
||||
from ansible.utils.unicode import to_unicode
|
||||
|
||||
class InventoryParser(object):
|
||||
"""
|
||||
@@ -231,13 +231,11 @@ class InventoryParser(object):
|
||||
# beta:2345 user=admin # we'll tell shlex
|
||||
# gamma sudo=True user=root # to ignore comments
|
||||
|
||||
line = to_bytes(line)
|
||||
try:
|
||||
tokens = shlex.split(line, comments=True)
|
||||
tokens = shlex_split(line, comments=True)
|
||||
except ValueError as e:
|
||||
self._raise_error("Error parsing host definition '%s': %s" % (varstring, e))
|
||||
|
||||
tokens = [ to_unicode(t) for t in tokens]
|
||||
(hostnames, port) = self._expand_hostpattern(tokens[0])
|
||||
hosts = self._Hosts(hostnames, port)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user