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.

(cherry picked from commit ae2d6e6ed2)
(cherry picked from commit 81a79af51e)

Change-Id: I8743bed2ca9888409a2f74fa0012f65b7b307e21
mr12.5.1
Guillem Jover 1 year ago committed by Rene Krenn
parent 6f0163c19a
commit 6d350fa852

@ -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]);
}

Loading…
Cancel
Save