From 07e150779df0f342643684c496ae1dfe891e42b0 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Sun, 24 Apr 2016 21:14:30 -0700 Subject: [PATCH] Switch from deprecated ANSIBLE_VERSION to ansible.__version__ --- lib/ansible/modules/extras/files/blockinfile.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/extras/files/blockinfile.py b/lib/ansible/modules/extras/files/blockinfile.py index 25f8cd0e80..3ff1bc7c72 100644 --- a/lib/ansible/modules/extras/files/blockinfile.py +++ b/lib/ansible/modules/extras/files/blockinfile.py @@ -18,10 +18,6 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -import re -import os -import tempfile - DOCUMENTATION = """ --- module: blockinfile @@ -150,6 +146,12 @@ EXAMPLES = r""" - { name: host3, ip: 10.10.1.12 } """ +import re +import os +import tempfile + +from ansible import __version__ + def write_changes(module, contents, dest): @@ -244,7 +246,7 @@ def main(): marker1 = re.sub(r'{mark}', 'END', marker) if present and block: # Escape seqeuences like '\n' need to be handled in Ansible 1.x - if ANSIBLE_VERSION.startswith('1.'): + if __version__.startswith('1.'): block = re.sub('', block, '') blocklines = [marker0] + block.splitlines() + [marker1] else: