yaegashi / ansible-role-blockinfile

Ansible role which contains blockinfile module
97 stars 18 forks source link

Handling escape sequence in ansible 1.7 #10

Open aq-eng opened 9 years ago

aq-eng commented 9 years ago

The following code block:

if present and block:
    # Escape seqeuences like '\n' need to be handled in Ansible 1.x                              
    if ANSIBLE_VERSION.startswith('1.'):                                                         
        block = re.sub('', block, '')                                                            
    blocklines = [marker0] + block.splitlines() + [marker1]

will crash under my test system with Ansible 1.7.

ANSIBLE_VERSION is not found and throws a NameError; my guess is that a newer version of ansible will import ANSIBE_VERSION with the wildcard imports but an older version does not. The program seems to work after removing the entire if block.

iliv commented 8 years ago

Yes, I mention this issue in #15 too.

How many parameters have you tried to use so far? Do you know if anything else is broken?

iliv commented 8 years ago

Oh, and did you have to rename the blockinfile.py file to blockinfile (without .py extenstion)?