| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Backup::Omni::Session::Filesystem; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1441
|
use Params::Validate ':all'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
337
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Backup::Omni::Class |
|
8
|
1
|
|
|
|
|
26
|
version => $VERSION, |
|
9
|
|
|
|
|
|
|
base => 'Backup::Omni::Base', |
|
10
|
|
|
|
|
|
|
utils => 'db2dt omni2dt trim', |
|
11
|
|
|
|
|
|
|
constants => 'OMNIDB', |
|
12
|
|
|
|
|
|
|
constant => { |
|
13
|
|
|
|
|
|
|
COMMAND => '%s -filesystem %s:%s "%s" -detail -since %s -until %s 2>&1', |
|
14
|
|
|
|
|
|
|
}, |
|
15
|
|
|
|
|
|
|
vars => { |
|
16
|
|
|
|
|
|
|
PARAMS => { |
|
17
|
|
|
|
|
|
|
-host => 1, |
|
18
|
|
|
|
|
|
|
-date => { regex => qr/\d{4}-\d\d-\d\d/ }, |
|
19
|
|
|
|
|
|
|
-path => { optional => 1, default => '/archive' }, |
|
20
|
|
|
|
|
|
|
-label => { optional => 1, default => '/archive' }, |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
} |
|
23
|
1
|
|
|
1
|
|
8
|
; |
|
|
1
|
|
|
|
|
3
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Params::Validate::validation_options( |
|
26
|
|
|
|
|
|
|
on_fail => sub { |
|
27
|
|
|
|
|
|
|
my $params = shift; |
|
28
|
|
|
|
|
|
|
my $class = __PACKAGE__; |
|
29
|
|
|
|
|
|
|
Backup::Omni::Base::validation_exception($params, $class); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
34
|
|
|
|
|
|
|
# Public Methods |
|
35
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
38
|
|
|
|
|
|
|
# Private Methods |
|
39
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub init { |
|
42
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $self = $class->SUPER::init(@_); |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $date = $self->date . ' 00:00:00'; |
|
47
|
0
|
|
|
|
|
|
my $since = db2dt($date); |
|
48
|
0
|
|
|
|
|
|
my $until = $since->clone->add(days => 1); |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $command = sprintf(COMMAND, OMNIDB, $self->host, $self->path, $self->label, $since->ymd('-'), $until->ymd('-')); |
|
51
|
0
|
|
|
|
|
|
my @result = `$command`; |
|
52
|
0
|
|
|
|
|
|
my $rc = $?; |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
unless (grep(/SessionID/, @result)) { |
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
$self->throw_msg( |
|
57
|
|
|
|
|
|
|
'backup.omni.session.filesystem', |
|
58
|
|
|
|
|
|
|
'nosession', |
|
59
|
|
|
|
|
|
|
$self->host, $self->date |
|
60
|
|
|
|
|
|
|
); |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
foreach my $line (@result) { |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
chomp($line); |
|
67
|
0
|
0
|
|
|
|
|
next if ($line eq ''); |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
$line =~ m/^(.*): (.*)/; |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $key = $1; |
|
72
|
0
|
|
|
|
|
|
my $value = $2; |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
$key = trim($key); |
|
75
|
0
|
|
|
|
|
|
$key =~ s/ /_/g; |
|
76
|
0
|
|
|
|
|
|
$key = lc($key); |
|
77
|
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
$value = trim($value); |
|
79
|
0
|
0
|
|
|
|
|
$value = omni2dt($value) if ($value =~ /\w\w\w \d\d \w\w\w \d\d\d\d/); |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# order is important here. Don't change |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
$self->class->accessors($key); # may cause redefination errors |
|
84
|
0
|
|
|
|
|
|
$self->{$key} = $value; |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
return $self; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__END__ |