Branch Coverage

lib/Sysync.pm
Criterion Covered Total %
branch 67 138 48.5


line true false branch
35 0 1 exists $$params{'salt_prefix'} ? :
79 0 2 unless $_[0]{'stagedir'}
87 0 1 unless $_[0]{'stagefilesdir'}
194 6 78 if ($$user{'password'}) { }
202 0 78 if $p
206 42 42 if ($what eq 'passwd') { }
42 0 elsif ($what eq 'shadow') { }
213 0 42 $$user{'disabled'} ? :
233 108 108 if ($what eq 'group') { }
108 0 elsif ($what eq 'gshadow') { }
262 0 0 unless $$data{'users'}
278 0 0 unless $$data{'groups'}
294 0 2 unless $$data{'users'}
312 0 2 unless $$data{'groups'}
329 0 3 unless $self->is_valid_host($host)
332 0 3 unless $$data{'users'}
333 0 3 unless $$data{'groups'}
343 39 3 unless $$user{'ssh_keys'}
345 0 3 if ($$user{'disabled'} and $$user{'ssh_keys'})
351 0 3 unless $$user{'ssh_keys'}
352 3 0 if $keys
354 0 3 unless $keys
404 0 1 unless $self->is_valid_host($host)
407 1 0 unless (-d "$stagefilesdir/$host")
417 1 0 unless (-d "$stagefilesdir/$host/etc")
427 1 0 unless (-d "$stagefilesdir/$host/etc/ssh")
437 1 0 unless (-d "$stagefilesdir/$host/etc/ssh/authorized_keys")
447 0 1 unless $files
450 1 0 unless $$item{'directory'}
454 0 0 if $$item{'directory'} eq '/etc'
455 0 0 if $$item{'directory'} eq '/etc/ssh'
456 0 0 if $$item{'directory'} eq '/etc/ssh/authorized_keys'
466 0 0 unless (-d "$stagefilesdir/$host/$parent_dir")
471 0 0 unless (-d "$stagefilesdir/$host/$$item{'directory'}")
484 0 1 unless $files
487 0 1 unless $$item{'file'}
496 0 1 unless (-d "$stagefilesdir/$host/$parent_dir")
501 1 0 if ($self->write_file_contents("$stagefilesdir/$host/$$item{'file'}", $$item{'data'}))
521 0 5 unless -e $staged_file
524 1 4 unless $local_staged_file
526 0 4 if $local_staged_file eq '/'
527 1 3 if $local_staged_file eq '/etc'
528 1 2 if $local_staged_file eq '/etc/ssh'
529 1 1 if $local_staged_file eq '/etc/ssh/authorized_keys'
531 0 1 unless ($$files{$local_staged_file})
533 0 0 if (-d $staged_file) { }
0 0 elsif (-e $staged_file) { }
564 0 1 unless $$hosts{'hosts'}
572 0 1 unless $self->is_valid_host($host)
574 1 0 unless (-d "$stagedir/$host")
583 1 0 unless (-d "$stagedir/$host/etc")
592 1 0 unless (-d "$stagedir/$host/etc/ssh")
601 1 0 unless (-d "$stagedir/$host/etc/ssh/authorized_keys")
613 0 1 unless $ent_data
615 0 1 unless $$ent_data{'ssh_keys'}
621 1 0 if ($self->write_file_contents("$stagedir/$host/etc/ssh/authorized_keys/$username", $text))
630 0 1 unless $$ent_data{'data'}{'groups'}
633 0 1 unless defined $shadow_group
636 1 0 if ($self->write_file_contents("$stagedir/$host/etc/passwd", $$ent_data{'passwd'}))
643 1 0 if ($self->write_file_contents("$stagedir/$host/etc/group", $$ent_data{'group'}))
650 1 0 if ($self->write_file_contents("$stagedir/$host/etc/shadow", $$ent_data{'shadow'}))
657 1 0 if ($self->write_file_contents("$stagedir/$host/etc/gshadow", $$ent_data{'gshadow'}))
678 0 6 if (-e $file)
680 0 0 if (md5_hex($data) eq md5_hex($self->read_file_contents($file)))
688 0 6 if (-e $file)
690 0 0 unless unlink $file
693 0 6 unless open F, "> $file"
708 0 100 if $params{'must_exist'} and not -f $file
711 78 22 unless -e $file