Bug in deleted cat (menu / app list) + better debug (#907)

environments/ppa-mbqj77/deployments/1
Xavier Guimard 9 years ago
parent 47a19d81ab
commit a67cc83c97
  1. 14
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm
  2. 16
      lemonldap-ng-manager/t/12-save-changed-conf.t

@ -391,12 +391,18 @@ sub _scanNodes {
$self->_scanNodes($subNodes) or return 0;
# Check for deleted
my @listCatRef = keys %{ $self->refConf->{applicationList} };
my @listCatRef =
map { $self->refConf->{applicationList}->{$_}->{catname} }
keys %{ $self->refConf->{applicationList} };
my @listCatNew =
map { $self->newConf->{applicationList}->{$_}->{catname} }
keys(
ref $self->newConf->{applicationList}
? $self->newConf->{applicationList}
: {} );
%{
ref $self->newConf->{applicationList}
? $self->newConf->{applicationList}
: {}
}
);
foreach my $cat (@listCatNew) {
@listCatRef = grep { $_ ne $cat } @listCatRef;
}

@ -36,15 +36,27 @@ while ( my $c = shift @{ $resBody->{details}->{__changes__} } ) {
my $cmp1 = @changes;
my $cmp2 = @cmsg;
my @d1 = grep { $_->{key} eq $c->{key} } @changes;
my @d2 = grep { $_->{key} eq $c->{key} } @cmsg;
@changes = grep { $_->{key} ne $c->{key} } @changes;
@cmsg = grep { $_->{key} ne $c->{key} } @cmsg;
ok( ( $cmp1 - @changes ) == ( $cmp2 - @cmsg ), "$c->{key} found" );
ok( ( $cmp1 - @changes ) == ( $cmp2 - @cmsg ), "$c->{key} found" )
or print STDERR 'Expect: '
. ( $cmp1 - @changes )
. ', got: '
. ( $cmp2 - @cmsg )
. "\nExpect: "
. Dumper( \@d1 ) . "Got: "
. Dumper( \@d2 );
count(1);
}
ok( !@changes, 'All changes detected' ) or $bug = 1;
if ($bug) {
print STDERR Dumper( \@changes, \@cmsg );
print STDERR 'Expected not found: '
. Dumper( \@changes )
. 'Changes announced and not found: '
. Dumper( \@cmsg );
}
#print STDERR Dumper(\@changes,\@cmsg);

Loading…
Cancel
Save