From 81a79af51ee019076df6958ecc694365a4a28198 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Thu, 7 Nov 2024 23:41:02 +0100 Subject: [PATCH] MT#61052 NGCP::Template::Plugin::Utils: Do not generate bogus YAML on empty string When we pass an empty string the current to_yaml() function generates broken YAML such as "--- ''", which then breaks code parsing that expecting valid YAML. If we pass an empty string, return an empty string as well. Change-Id: I010cd9d544bd505446f0016ecc6302a987921570 (cherry picked from commit ae2d6e6ed28e63aca03e08cf67722c44e73fd1d3) --- lib/NGCP/Template/Plugin/Utils.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/NGCP/Template/Plugin/Utils.pm b/lib/NGCP/Template/Plugin/Utils.pm index 21adc8b5..3c40f07a 100644 --- a/lib/NGCP/Template/Plugin/Utils.pm +++ b/lib/NGCP/Template/Plugin/Utils.pm @@ -40,6 +40,7 @@ sub to_config_general { sub to_yaml { my ($self, @params) = @_; + return q{} unless $params[0]; return YAML::XS::Dump($params[0]); }