use utf8 decode

This commit is contained in:
Robert Kaussow 2021-06-08 01:48:39 +02:00
parent af357c29ce
commit 3e6740d498
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
1 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ class CheckNativeYaml(StandardBase):
action = normal_form["action"]["__ansible_module__"]
arguments = [
bytes(x, "utf-8").decode("unicode_escape")
bytes(x, "utf-8").decode("utf8", "ignore")
for x in normal_form["action"]["__ansible_arguments__"]
]
# Cope with `set_fact` where task["set_fact"] is None
@ -30,7 +30,7 @@ class CheckNativeYaml(StandardBase):
if isinstance(task[action], dict):
continue
# strip additional newlines off task[action]
task_action = bytes(repr(task[action].strip()), "utf-8").decode("unicode_escape")
if task_action.strip("'").strip('"').split() != arguments:
task_action = bytes(task[action].strip(), "utf-8").decode("utf8", "ignore")
if task_action.split() != arguments:
errors.append(self.Error(task["__line__"], self.helptext))
return self.Result(candidate.path, errors)