line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Backup::Omni::Restore::Filesystem::Single; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1601
|
use Params::Validate ':all'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
299
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Backup::Omni::Class |
8
|
1
|
|
|
|
|
17
|
version => $VERSION, |
9
|
|
|
|
|
|
|
base => 'Backup::Omni::Base', |
10
|
|
|
|
|
|
|
utils => 'trim', |
11
|
|
|
|
|
|
|
constants => 'OMNIR', |
12
|
|
|
|
|
|
|
constant => { |
13
|
|
|
|
|
|
|
COMMAND => '%s -filesystem %s:%s "%s" -session %s -tree %s -full -as %s -target %s -no_monitor', |
14
|
|
|
|
|
|
|
}, |
15
|
|
|
|
|
|
|
vars => { |
16
|
|
|
|
|
|
|
PARAMS => { |
17
|
|
|
|
|
|
|
-host => 1, |
18
|
|
|
|
|
|
|
-session => 1, |
19
|
|
|
|
|
|
|
-target => 1, |
20
|
|
|
|
|
|
|
-from => 1, |
21
|
|
|
|
|
|
|
-to => 1, |
22
|
|
|
|
|
|
|
-label => { optional => 1, default => '/archive' }, |
23
|
|
|
|
|
|
|
-path => { optional => 1, default => '/archive' }, |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
1
|
|
|
1
|
|
7
|
; |
|
1
|
|
|
|
|
2
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Params::Validate::validation_options( |
29
|
|
|
|
|
|
|
on_fail => sub { |
30
|
|
|
|
|
|
|
my $params = shift; |
31
|
|
|
|
|
|
|
my $class = __PACKAGE__; |
32
|
|
|
|
|
|
|
Backup::Omni::Base::validation_exception($params, $class); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
37
|
|
|
|
|
|
|
# Public Methods |
38
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub submit { |
41
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my $session = ''; |
44
|
0
|
|
|
|
|
|
my $command = sprintf(COMMAND, OMNIR, $self->host, $self->path, $self->label, $self->session, $self->from, $self->to, $self->target); |
45
|
0
|
|
|
|
|
|
my @results = `$command`; |
46
|
0
|
|
|
|
|
|
my $rc = $?; |
47
|
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
|
unless (grep(/Restore successfully/, @results)) { |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
$self->throw_msg( |
51
|
|
|
|
|
|
|
'backup.omni.restore.filesystem.single.submit', |
52
|
|
|
|
|
|
|
'nosubmit', |
53
|
|
|
|
|
|
|
$self->session |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
foreach my $line (@results) { |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
chomp($line); |
61
|
0
|
0
|
|
|
|
|
next if ($line eq ''); |
62
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
if ($line =~ /(R-.*)/) { |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$session = $1; |
66
|
0
|
|
|
|
|
|
last; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return trim($session); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
77
|
|
|
|
|
|
|
# Private Methods |
78
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |