diff options
author | Toshio Kuratomi <toshio@fedoraproject.org> | 2016-04-24 21:14:30 -0700 |
---|---|---|
committer | Toshio Kuratomi <toshio@fedoraproject.org> | 2016-04-24 21:15:15 -0700 |
commit | d871df6c27a5d5baacb7c155c3db15b61237e97b (patch) | |
tree | 82d0cf25f9c2d5452cafaaaa2051d3183665be7b /files/blockinfile.py | |
parent | de22b721db288e1c3894b3d763442813e8bcc4f2 (diff) | |
download | ansible-modules-extras-d871df6c27a5d5baacb7c155c3db15b61237e97b.tar.gz |
Switch from deprecated ANSIBLE_VERSION to ansible.__version__
Diffstat (limited to 'files/blockinfile.py')
-rw-r--r-- | files/blockinfile.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/files/blockinfile.py b/files/blockinfile.py index 25f8cd0e..3ff1bc7c 100644 --- a/files/blockinfile.py +++ b/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 <http://www.gnu.org/licenses/>. -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: |