Branch Coverage

lib/Sysync.pm
Criterion Covered Total %
branch 71 148 47.9


line true false branch
42 0 1 exists $params->{'salt_prefix'} ? :
80 0 2 unless $_[0]{'stagedir'}
88 0 1 unless $_[0]{'stagefilesdir'}
195 6 78 if ($user->{'password'}) { }
203 0 78 if $p
207 42 42 if ($what eq 'passwd') { }
42 0 elsif ($what eq 'shadow') { }
214 0 42 $user->{'disabled'} ? :
234 108 108 if ($what eq 'group') { }
108 0 elsif ($what eq 'gshadow') { }
263 0 0 unless $data->{'users'}
279 0 0 unless $data->{'groups'}
295 0 2 unless $data->{'users'}
313 0 2 unless $data->{'groups'}
330 0 3 unless $self->is_valid_host($host)
333 0 3 unless $data->{'users'}
334 0 3 unless $data->{'groups'}
344 39 3 unless $user->{'ssh_keys'}
346 0 0 if ($user->{'disabled'} and $user->{'ssh_keys'})
352 0 3 unless $user->{'ssh_keys'}
353 3 0 if $keys
355 0 3 unless $keys
405 0 1 unless $self->is_valid_host($host)
408 1 0 unless (-d "$stagefilesdir/$host")
418 1 0 unless (-d "$stagefilesdir/$host/etc")
428 1 0 unless (-d "$stagefilesdir/$host/etc/ssh")
438 1 0 unless (-d "$stagefilesdir/$host/etc/ssh/authorized_keys")
448 0 1 unless $files
451 1 0 unless $item->{'directory'}
455 0 0 if $item->{'directory'} eq "/etc"
456 0 0 if $item->{'directory'} eq "/etc/ssh"
457 0 0 if $item->{'directory'} eq "/etc/ssh/authorized_keys"
467 0 0 unless (-d "$stagefilesdir/$host/$parent_dir")
472 0 0 unless (-d "$stagefilesdir/$host/$item->{'directory'}")
485 0 1 unless $files
488 0 1 unless $item->{'file'}
497 0 1 unless (-d "$stagefilesdir/$host/$parent_dir")
502 1 0 if ($self->write_file_contents("$stagefilesdir/$host/$item->{'file'}", $item->{'data'}))
522 0 5 unless -e $staged_file
525 1 4 unless $local_staged_file
527 0 4 if $local_staged_file eq "/"
528 1 3 if $local_staged_file eq "/etc"
529 1 2 if $local_staged_file eq "/etc/ssh"
530 1 1 if $local_staged_file eq "/etc/ssh/authorized_keys"
531 0 1 if $local_staged_file eq "/var/lib/extrausers"
533 0 1 unless ($files->{$local_staged_file})
535 0 0 if (-d $staged_file) { }
0 0 elsif (-e $staged_file) { }
566 0 1 unless $hosts->{'hosts'}
572 0 1 if ($hosts->{'extra_users'} or $self->{'extra_users'})
587 0 1 unless $self->is_valid_host($host)
589 1 0 unless (-d "$stagedir/$host")
598 1 0 unless (-d "$stagedir/$host/etc")
607 1 0 unless (-d "$stagedir/$host/etc/ssh")
616 1 0 unless (-d "$stagedir/$host/etc/ssh/authorized_keys")
625 1 0 unless (-d "$stagedir/$host/var")
635 1 0 unless (-d "$stagedir/$host/var/lib")
645 1 0 unless (-d "$stagedir/$host/var/lib/extrausers")
658 0 1 unless $ent_data
660 0 1 unless $ent_data->{'ssh_keys'}
666 1 0 if ($self->write_file_contents("$stagedir/$host/etc/ssh/authorized_keys/$username", $text))
676 0 1 unless $ent_data->{'data'}{'groups'}
678 0 1 unless defined $shadow_group
681 1 0 if ($self->write_file_contents("$stagedir/$host/$passwd_file", $ent_data->{'passwd'}))
688 1 0 if ($self->write_file_contents("$stagedir/$host/$group_file", $ent_data->{'group'}))
695 1 0 if ($self->write_file_contents("$stagedir/$host/$shadow_file", $ent_data->{'shadow'}))
702 1 0 if ($self->write_file_contents("$stagedir/$host/$gshadow_file", $ent_data->{'gshadow'}))
723 0 6 if (-e $file)
725 0 0 if (md5_hex($data) eq md5_hex($self->read_file_contents($file)))
733 0 6 if (-e $file)
735 0 0 unless unlink $file
738 0 6 unless open F, "> $file"
754 0 100 if $params{'must_exist'} and not -f $file
756 78 22 unless -e $file