| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Ixchel::Actions::sneck_install; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
113039
|
use 5.006; |
|
|
1
|
|
|
|
|
4
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
41
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
48
|
|
|
6
|
1
|
|
|
1
|
|
448
|
use Ixchel::functions::install_cpanm; |
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
149
|
|
|
7
|
1
|
|
|
1
|
|
17
|
use Ixchel::functions::perl_module_via_pkg; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
85
|
|
|
8
|
1
|
|
|
1
|
|
9
|
use base 'Ixchel::Actions::base'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
51
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Ixchel::Actions::sneck_install - Installs Sneck using packages as much as possible. |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Version 0.1.0 |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.1.0'; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 CLI SYNOPSIS |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
ixchel -a sneck_install |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 CODE SYNOPSIS |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use Data::Dumper; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $results=$ixchel->action(action=>'sneck_install', opts=>{}); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
if ($results->{ok}) { |
|
33
|
|
|
|
|
|
|
print $results->{status_text}; |
|
34
|
|
|
|
|
|
|
}else{ |
|
35
|
|
|
|
|
|
|
die('Action errored... '.joined("\n", @{$results->{errors}})); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 RESULT HASH REF |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
.errors :: A array of errors encountered. |
|
41
|
|
|
|
|
|
|
.status_text :: A string description of what was done and the results. |
|
42
|
|
|
|
|
|
|
.ok :: Set to zero if any of the above errored. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
0
|
0
|
|
sub new_extra { } |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub action_extra { |
|
49
|
0
|
|
|
0
|
0
|
|
my $self = $_[0]; |
|
50
|
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
$self->status_add( status => 'Installing Monitoring::Sneck depends via packages' ); |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
my @depends = ( 'JSON', 'File::Slurp', 'MIME::Base64', 'Pod::Usage' ); |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
$self->status_add( status => 'Perl Depends: ' . join( ', ', @depends ) ); |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
my @installed; |
|
58
|
|
|
|
|
|
|
my @failed; |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
foreach my $depend (@depends) { |
|
61
|
0
|
|
|
|
|
|
my $status; |
|
62
|
0
|
|
|
|
|
|
$self->status_add( status => 'Trying to install ' . $depend . ' as a package...' ); |
|
63
|
0
|
|
|
|
|
|
eval { $status = perl_module_via_pkg( module => $depend ); }; |
|
|
0
|
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
|
if ($@) { |
|
65
|
0
|
|
|
|
|
|
push( @failed, $depend ); |
|
66
|
0
|
|
|
|
|
|
$self->status_add( status => $depend . ' could not be installed as a package' ); |
|
67
|
|
|
|
|
|
|
} else { |
|
68
|
0
|
|
|
|
|
|
push( @installed, $depend ); |
|
69
|
0
|
|
|
|
|
|
$self->status_add( status => $depend . ' could not be installed as a package' ); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
} ## end foreach my $depend (@depends) |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
my $output = `cpanm Monitoring::Sneck 2>&1`; |
|
74
|
0
|
0
|
|
|
|
|
if ( $? != 0 ) { |
|
75
|
0
|
|
|
|
|
|
$self->status_add( |
|
76
|
|
|
|
|
|
|
status => "Failed to install Sneck via cpanm ... cpanm Monitoring::Sneck exited non-zero\n" . $output, |
|
77
|
|
|
|
|
|
|
error => 1 |
|
78
|
|
|
|
|
|
|
); |
|
79
|
|
|
|
|
|
|
} else { |
|
80
|
0
|
|
|
|
|
|
$self->status_add( status => 'Sneck installed' ); |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
$self->status_add( status => 'Installed via Packages: ' . join( ', ', @installed ) ); |
|
84
|
0
|
|
|
|
|
|
$self->status_add( status => 'Needed via cpanm: ' . join( ', ', @failed ) ); |
|
85
|
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
return undef; |
|
87
|
|
|
|
|
|
|
} ## end sub action_extra |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub short { |
|
90
|
0
|
|
|
0
|
1
|
|
return 'Installs Sneck using packages as much as possible.'; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub opts_data { |
|
94
|
0
|
|
|
0
|
1
|
|
return ' |
|
95
|
|
|
|
|
|
|
'; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |