From 0050d11797e567601961c6cd932466367e4a8a3a Mon Sep 17 00:00:00 2001 From: Remi Paulmier Date: Mon, 26 Dec 2016 16:41:42 +0100 Subject: [PATCH] import the right symbols if ansible version >= 2.2 --- lxc_ssh.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lxc_ssh.py b/lxc_ssh.py index b425652..02d22ca 100644 --- a/lxc_ssh.py +++ b/lxc_ssh.py @@ -29,7 +29,13 @@ from ansible.compat.six import text_type, binary_type from ansible.plugins.connection import ConnectionBase from ansible.utils.path import unfrackpath, makedirs_safe -from ansible.utils.unicode import to_bytes, to_unicode, to_str + +from ansible.release import __version__ as ansible_version +from distutils.version import LooseVersion +if LooseVersion(ansible_version) >= LooseVersion('2.2.0.0'): + from ansible.module_utils._text import to_bytes, to_text as to_unicode, to_native as to_str +else: + from ansible.utils.unicode import to_bytes, to_unicode, to_str try: from __main__ import display