line |
true |
false |
branch |
199
|
3 |
16 |
if (ref $params[0] eq 'HASH') { } |
206
|
19 |
0 |
unless (exists $param->{'server'}) |
211
|
16 |
3 |
if (ref $file and ref $file eq 'SCALAR') { } |
217
|
1 |
2 |
unless ($file =~ m[^/]u or $file =~ /^\@/u) |
234
|
0 |
3 |
if (-f "$file." . "Rex::Config"->get_environment) |
238
|
1 |
2 |
if (-f $file) { } |
|
2 |
0 |
elsif ($file =~ /^\@/u) { } |
246
|
2 |
0 |
unless (-f $file_path) |
248
|
0 |
2 |
if ($mod_name and -f "$file_path/$mod_name.pm") { } |
|
0 |
2 |
elsif (-f "$file_path/__module__.pm") { } |
|
0 |
2 |
elsif (-f "$file_path/Module.pm") { } |
|
2 |
0 |
elsif (-f $caller[1]) { } |
|
0 |
0 |
elsif ($caller[1] =~ m[^/loader/[^/]+/__Rexfile__.pm$]u) { } |
277
|
13 |
6 |
if (not exists $param->{'__no_sys_info__'}) { } |
288
|
25 |
1 |
unless (exists $template_vars{$key}) |
293
|
4 |
15 |
if (Rex::CMDB::cmdb_active() and "Rex::Config"->get_register_cmdb_template) |
296
|
26 |
2 |
unless (exists $template_vars{$key}) |
308
|
0 |
13 |
unless $param |
311
|
0 |
13 |
if (Rex::get_cache()->valid('system_information_info')) { } |
436
|
0 |
53 |
if (ref $file eq "ARRAY") |
452
|
2 |
51 |
if (exists $option->{'ensure'} and $option->{'ensure'} eq "directory") |
456
|
3 |
50 |
if (exists $option->{'source'} and not $is_directory) |
465
|
4 |
49 |
if ($option->{'ensure'} ne "absent" and $fs->is_symlink($file)) |
475
|
3 |
50 |
if (@new_args) |
480
|
0 |
53 |
unless (eval {
do {
my(@new_args) = Rex::Hook::run_hook("file", "before", $file, %{$option;});
if (@new_args) {
($file, @options) = @new_args;
$option = {@options};
};
1
}
}) |
488
|
3 |
50 |
$option->{'on_change'} && !$is_directory ? : |
496
|
0 |
53 |
if (exists $option->{'no_overwrite'} and $option->{'no_overwrite'} and $fs->is_file($file)) { } |
|
42 |
22 |
elsif (exists $option->{'content'} || exists $option->{'source'} and not $is_directory) { } |
520
|
39 |
3 |
if (exists $option->{'content'}) { } |
|
3 |
0 |
elsif (exists $option->{'source'}) { } |
539
|
4 |
38 |
if ($new_md5 and $old_md5 and $new_md5 eq $old_md5) { } |
564
|
0 |
38 |
if (Rex::is_sudo()) |
569
|
0 |
0 |
if (exists $current_options->{'user'}) |
575
|
0 |
38 |
if Rex::is_sudo() |
593
|
53 |
0 |
if (exists $option->{'ensure'}) |
594
|
49 |
4 |
if ($option->{'ensure'} eq 'present') { } |
|
2 |
2 |
elsif ($option->{'ensure'} eq 'absent') { } |
|
2 |
0 |
elsif ($option->{'ensure'} eq 'directory') { } |
595
|
1 |
48 |
if (not $fs->is_file($file)) { } |
|
10 |
38 |
elsif (not $__ret->{'changed'}) { } |
631
|
2 |
0 |
if ($fs->is_file($file)) { } |
|
0 |
0 |
elsif ($fs->is_dir($file)) { } |
660
|
0 |
2 |
if (exists $option->{'owner'}) |
663
|
0 |
2 |
if (exists $option->{'group'}) |
666
|
0 |
2 |
if (exists $option->{'mode'}) |
674
|
9 |
44 |
if (not exists $option->{'content'} || exists $option->{'source'} and $option->{'ensure'} ne "absent") |
680
|
0 |
2 |
unless ($fs->is_file($file) or $is_directory) |
691
|
0 |
0 |
if (exists $option->{'ensure'} and $option->{'ensure'} eq "directory") |
707
|
51 |
2 |
if ($option->{'ensure'} ne "absent") |
709
|
2 |
49 |
if ($need_md5) |
714
|
28 |
23 |
if (exists $option->{'mode'}) |
718
|
25 |
26 |
if (exists $option->{'group'}) |
722
|
25 |
26 |
if (exists $option->{'owner'}) |
728
|
15 |
36 |
if (%stat_old and %stat_new and $stat_old{'mode'} ne $stat_new{'mode'}) |
736
|
0 |
51 |
if (%stat_old and %stat_new and $stat_old{'uid'} ne $stat_new{'uid'}) |
743
|
0 |
51 |
if (%stat_old and %stat_new and $stat_old{'gid'} ne $stat_new{'gid'}) |
754
|
2 |
51 |
if ($need_md5) |
755
|
0 |
0 |
unless ($old_md5 and $new_md5 and $old_md5 eq $new_md5) |
776
|
39 |
14 |
if ($__ret->{'changed'} == 1 and $on_change_done == 0) { } |
|
12 |
2 |
elsif ($__ret->{'changed'} == 0) { } |
801
|
5 |
39 |
$dirname eq '.' ? : |
838
|
0 |
42 |
unless ($fh->open(">", $file)) |
858
|
0 |
1 |
unless ($fh->open(">>", $file)) |
896
|
0 |
137 |
unless ($fh->open("<", $file)) |
917
|
0 |
86 |
unless ($fh) |
944
|
1 |
0 |
if (ref $_ ne "Regexp") |
953
|
0 |
1 |
unless ($fs->is_file($file)) |
958
|
0 |
1 |
unless ($fs->is_writable($file)) |
975
|
1 |
0 |
if ($line =~ /$match/u) |
992
|
1 |
0 |
if ($new_md5 ne $old_md5) { } |
1031
|
0 |
0 |
if ($on_change) |
1037
|
0 |
0 |
if ($on_change or $on_no_change) |
1040
|
0 |
0 |
if ($old_md5 ne $new_md5) { } |
1041
|
0 |
0 |
if $on_change |
1044
|
0 |
0 |
if $on_no_change |
1123
|
4 |
15 |
unless (exists $option->{'line'}) |
1127
|
10 |
5 |
if (exists $option->{'regexp'} and ref $option->{'regexp'} eq 'Regexp') { } |
|
2 |
3 |
elsif (ref $option->{'regexp'} eq 'ARRAY') { } |
1136
|
4 |
15 |
unless (eval {
do {
no warnings;
$option = {@_};
unless (exists $option->{'line'}) {
die;
};
$new_line = $option->{'line'};
if (exists $option->{'regexp'} and ref $option->{'regexp'} eq "Regexp") {
@m = $option->{'regexp'};
}
elsif (ref $option->{'regexp'} eq "ARRAY") {
@m = @{$option->{'regexp'};};
};
$on_change = $option->{'on_change'} || undef;
$on_no_change = $option->{'on_no_change'} || undef;
1
}
}) |
1144
|
5 |
3 |
if ($m[$i] eq $option->[0] and ref $m[$i + 1] eq "CODE") |
1153
|
0 |
19 |
unless (defined $new_line) |
1171
|
0 |
19 |
unless (eval {
do {
$content = [split(/\n/u, cat($file), 0)];
1
}
}) |
1175
|
5 |
14 |
unless (@m) |
1182
|
0 |
144 |
if (ref $match ne "Regexp") |
1185
|
9 |
135 |
if ($content->[$line] =~ /$match/u) |
1187
|
6 |
3 |
if $action eq "append_if_no_such_line" |
1194
|
6 |
13 |
if ($action eq 'append_if_no_such_line' and $found) { } |
1198
|
10 |
3 |
unless $found |
1208
|
3 |
16 |
if ($on_change or $on_no_change) |
1209
|
1 |
2 |
if ($old_md5 and $new_md5 and $old_md5 ne $new_md5) { } |
|
2 |
0 |
elsif ($on_no_change) { } |
1210
|
1 |
0 |
if ($on_change) |
1230
|
13 |
6 |
if ($old_md5 and $new_md5 and $old_md5 ne $new_md5) { } |
1273
|
0 |
0 |
if ($option{'chdir'}) |
1277
|
0 |
0 |
if ($option{'to'}) |
1282
|
0 |
0 |
if ($option{'type'}) |
1292
|
0 |
0 |
if ($type eq 'tgz' or $file =~ /\.tar\.gz$/u or $file =~ /\.tgz$/u or $file =~ /\.tar\.Z$/u) { } |
|
0 |
0 |
elsif ($type eq 'tbz' or $file =~ /\.tar\.bz2/u or $file =~ /\.tbz2/u) { } |
|
0 |
0 |
elsif ($type eq 'tar' or $file =~ /\.(tar|box)/u) { } |
|
0 |
0 |
elsif ($type eq 'zip' or $file =~ /\.(zip|war|jar)$/u) { } |
|
0 |
0 |
elsif ($type eq 'gz' or $file =~ /\.gz$/u) { } |
|
0 |
0 |
elsif ($type eq 'bz2' or $file =~ /\.bz2$/u) { } |
1322
|
0 |
0 |
if ($option{'owner'}) |
1326
|
0 |
0 |
if ($option{'group'}) |
1330
|
0 |
0 |
if ($option{'mode'}) |
1361
|
0 |
11 |
if (ref $option[0]) { } |
1373
|
1 |
10 |
if (exists $options->{'multiline'}) { } |