Skip to content

Commit ced4fab

Browse files
authored
Avoid importing six. (#112)
1 parent f893691 commit ced4fab

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

changelogs/fragments/six.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- "Avoid importing ``ansible.module_utils.six`` (https://github.com/felixfontein/ansible-acme/pull/112)."

plugins/filter/_substitute_dns.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@
5656
type: string
5757
'''
5858

59+
import sys
60+
5961
from ansible.errors import AnsibleFilterError
60-
from ansible.module_utils.six import string_types
6162
from ansible.module_utils.common.text.converters import to_text, to_native
6263

6364
try:
@@ -66,6 +67,11 @@
6667
# Python 2.x compat
6768
from collections import Mapping
6869

70+
if sys.version_info >= (3,):
71+
string_types = (str,)
72+
else:
73+
string_types = basestring # pylint: disable=undefined-variable
74+
6975

7076
def substitute_dns(name, substitution_map):
7177
if not isinstance(name, string_types):

0 commit comments

Comments
 (0)