Don't include self-referential structures in list of interfaces, as they can't be serialized

This commit is contained in:
Jamie Cameron
2020-08-22 17:48:27 -07:00
parent 4313adf159
commit 33f7ad52fd

View File

@@ -627,9 +627,23 @@ foreach my $origl (@$lref) {
}
$lnum++;
}
&cleanup_yaml_parents($rv);
return $rv;
}
# cleanup_yaml_parents(&config)
# Remove all 'parent' fields once parsing is done, as they can't be serialized
sub cleanup_yaml_parents
{
my ($conf) = @_;
foreach my $c (@$conf) {
delete($c->{'parent'});
if ($c->{'members'}) {
&cleanup_yaml_parents($c->{'members'});
}
}
}
# yaml_lines(&directive, indent-string)
sub yaml_lines
{