mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Switch blockinfile to using the latest best way to get ansible version
This commit is contained in:
parent
41c8e43e34
commit
fda13deb08
1 changed files with 1 additions and 3 deletions
|
@ -150,8 +150,6 @@ import re
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from ansible import __version__
|
|
||||||
|
|
||||||
|
|
||||||
def write_changes(module, contents, dest):
|
def write_changes(module, contents, dest):
|
||||||
|
|
||||||
|
@ -246,7 +244,7 @@ def main():
|
||||||
marker1 = re.sub(r'{mark}', 'END', marker)
|
marker1 = re.sub(r'{mark}', 'END', marker)
|
||||||
if present and block:
|
if present and block:
|
||||||
# Escape seqeuences like '\n' need to be handled in Ansible 1.x
|
# Escape seqeuences like '\n' need to be handled in Ansible 1.x
|
||||||
if __version__.startswith('1.'):
|
if module.constants['ANSIBLE_VERSION'].startswith('1.'):
|
||||||
block = re.sub('', block, '')
|
block = re.sub('', block, '')
|
||||||
blocklines = [marker0] + block.splitlines() + [marker1]
|
blocklines = [marker0] + block.splitlines() + [marker1]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue