From cb89670f0267930072ef770890af240182f59098 Mon Sep 17 00:00:00 2001 From: hirokuni-kitahara Date: Fri, 29 Sep 2023 11:46:11 +0900 Subject: [PATCH] enable to set task name to mutable content Signed-off-by: hirokuni-kitahara --- ansible_risk_insight/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ansible_risk_insight/models.py b/ansible_risk_insight/models.py index ecbc6069..c8834e0e 100644 --- a/ansible_risk_insight/models.py +++ b/ansible_risk_insight/models.py @@ -1404,6 +1404,16 @@ def from_task_spec(task_spec): ) return mc + def set_task_name(self, task_name: str): + # if `name` is None or empty string, Task.yaml() won't output the field + self._task_spec.name = task_name + self._yaml = self._task_spec.yaml() + self._task_spec.yaml_lines = self._yaml + return self + + def get_task_name(self): + return self._task_spec.name + def omit_task_name(self): # if `name` is None or empty string, Task.yaml() won't output the field self._task_spec.name = None