From 1d455ab85cc3881c1a00c4e503a3fb96dc00355d Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 4 Mar 2020 12:29:35 +0100 Subject: [PATCH] decode task actions to prevent errors --- CHANGELOG.md | 2 +- ansiblelater/__init__.py | 2 +- ansiblelater/rules/yamlfiles.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40eceae..701bef6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,2 @@ * BUGFIX - * replace removed dependency `ansible.module_utils.parsing.convert_bool` + * decode task actions to prevent errors on multiline strings diff --git a/ansiblelater/__init__.py b/ansiblelater/__init__.py index b1101d2..343c1df 100644 --- a/ansiblelater/__init__.py +++ b/ansiblelater/__init__.py @@ -2,7 +2,7 @@ __author__ = "Robert Kaussow" __project__ = "ansible-later" -__version__ = "0.3.0" +__version__ = "0.3.1" __license__ = "MIT" __maintainer__ = "Robert Kaussow" __email__ = "mail@geeklabor.de" diff --git a/ansiblelater/rules/yamlfiles.py b/ansiblelater/rules/yamlfiles.py index 29f30c3..aa72832 100644 --- a/ansiblelater/rules/yamlfiles.py +++ b/ansiblelater/rules/yamlfiles.py @@ -42,7 +42,8 @@ def check_native_yaml(candidate, settings): if isinstance(task[action], dict): continue # strip additional newlines off task[action] - if task[action].strip().split() != arguments: + task_action = bytes(task[action].strip(), "utf-8").decode("unicode_escape") + if task_action.split() != arguments: errors.append(Error(task["__line__"], description)) return Result(candidate.path, errors)