ansible-role-blockinfile icon indicating copy to clipboard operation
ansible-role-blockinfile copied to clipboard

Handling escape sequence in ansible 1.7

Open aq-eng opened this issue 8 years ago • 2 comments

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.

aq-eng avatar Oct 23 '15 18:10 aq-eng