diff --git a/plugins/modules/firewall.py b/plugins/modules/firewall.py index f8dd3090..ddd8e245 100644 --- a/plugins/modules/firewall.py +++ b/plugins/modules/firewall.py @@ -241,7 +241,7 @@ def _prepare_result(self): def _prepare_result_rule(self, rule: FirewallRule): return { - "direction": rule.direction, + "direction": to_native(rule.direction), "protocol": to_native(rule.protocol), "port": to_native(rule.port) if rule.port is not None else None, "source_ips": [to_native(cidr) for cidr in rule.source_ips], @@ -251,15 +251,17 @@ def _prepare_result_rule(self, rule: FirewallRule): def _prepare_result_applied_to(self, resource: FirewallResource): result = { - "type": resource.type, + "type": to_native(resource.type), "server": to_native(resource.server.id) if resource.server is not None else None, - "label_selector": resource.label_selector.selector if resource.label_selector is not None else None, + "label_selector": to_native(resource.label_selector.selector) + if resource.label_selector is not None + else None, } if resource.applied_to_resources is not None: result["applied_to_resources"] = [ { - "type": item.type, - "server": item.server.id if item.server is not None else None, + "type": to_native(item.type), + "server": to_native(item.server.id) if item.server is not None else None, } for item in resource.applied_to_resources ] diff --git a/plugins/modules/firewall_info.py b/plugins/modules/firewall_info.py index b9932dac..4f368c6e 100644 --- a/plugins/modules/firewall_info.py +++ b/plugins/modules/firewall_info.py @@ -180,7 +180,7 @@ def _prepare_result(self): def _prepare_result_rule(self, rule: FirewallRule): return { "description": to_native(rule.description) if rule.description is not None else None, - "direction": rule.direction, + "direction": to_native(rule.direction), "protocol": to_native(rule.protocol), "port": to_native(rule.port) if rule.port is not None else None, "source_ips": [to_native(cidr) for cidr in rule.source_ips], @@ -189,15 +189,17 @@ def _prepare_result_rule(self, rule: FirewallRule): def _prepare_result_applied_to(self, resource: FirewallResource): result = { - "type": resource.type, + "type": to_native(resource.type), "server": to_native(resource.server.id) if resource.server is not None else None, - "label_selector": resource.label_selector.selector if resource.label_selector is not None else None, + "label_selector": to_native(resource.label_selector.selector) + if resource.label_selector is not None + else None, } if resource.applied_to_resources is not None: result["applied_to_resources"] = [ { - "type": item.type, - "server": item.server.id if item.server is not None else None, + "type": to_native(item.type), + "server": to_native(item.server.id) if item.server is not None else None, } for item in resource.applied_to_resources ]