Skip to content

Commit 6d350fa

Browse files
guillemjRene Krenn
authored andcommitted
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 ae2d6e6) (cherry picked from commit 81a79af) Change-Id: I8743bed2ca9888409a2f74fa0012f65b7b307e21
1 parent 6f0163c commit 6d350fa

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/NGCP/Template/Plugin/Utils.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ sub to_config_general {
4040

4141
sub to_yaml {
4242
my ($self, @params) = @_;
43+
return q{} unless $params[0];
4344
return YAML::XS::Dump($params[0]);
4445
}
4546

0 commit comments

Comments
 (0)