From d8c8ca11cfa0787bc14655439b080a9b7c4962e5 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 3 Jun 2015 08:45:10 -0700 Subject: [PATCH] Add compatibility for old version of six (present on rhel7) --- lib/ansible/parsing/vault/__init__.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/ansible/parsing/vault/__init__.py b/lib/ansible/parsing/vault/__init__.py index 40d02d3d59c..6c2b7c9c62d 100644 --- a/lib/ansible/parsing/vault/__init__.py +++ b/lib/ansible/parsing/vault/__init__.py @@ -36,7 +36,19 @@ from hashlib import sha256 from hashlib import md5 from binascii import hexlify from binascii import unhexlify -from six import binary_type, byte2int, PY2, text_type +from six import binary_type, PY2, text_type + +try: + from six import byte2int +except ImportError: + # bytes2int added in six-1.4.0 + if PY2: + def byte2int(bs): + return ord(bs[0]) + else: + import operator + byte2int = operator.itemgetter(0) + from ansible import constants as C from ansible.utils.unicode import to_unicode, to_bytes