line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Clustericious::Admin; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
7565
|
use strict; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
142
|
|
4
|
3
|
|
|
3
|
|
37
|
use warnings; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
123
|
|
5
|
3
|
|
|
3
|
|
21
|
use App::clad; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
70
|
|
6
|
3
|
|
|
3
|
|
19
|
use Carp (); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
884
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Parallel SSH client |
9
|
|
|
|
|
|
|
our $VERSION = '1.10'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub banners |
14
|
|
|
|
|
|
|
{ |
15
|
1
|
|
|
1
|
1
|
2599
|
(undef) = @_; |
16
|
1
|
|
|
|
|
17
|
Carp::carp "Class method call of Clustericious::Admin->banners is deprecated"; |
17
|
1
|
|
|
|
|
415
|
(); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub clusters |
22
|
|
|
|
|
|
|
{ |
23
|
1
|
|
|
1
|
1
|
3230
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
ref $self |
26
|
|
|
|
|
|
|
? $self->SUPER::new($_) |
27
|
1
|
50
|
|
|
|
4
|
: do { |
28
|
1
|
|
|
|
|
12
|
Carp::carp "Class method call of Clustericious::Admin->clusters is deprecated"; |
29
|
1
|
|
|
|
|
389
|
sort keys %{ App::clad->new('--server')->cluster_list }; |
|
1
|
|
|
|
|
8
|
|
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub aliases |
35
|
|
|
|
|
|
|
{ |
36
|
1
|
|
|
1
|
1
|
3872
|
(undef) = @_; |
37
|
1
|
|
|
|
|
17
|
Carp::carp "Class method call of Clustericious::Admin->aliases is deprecated"; |
38
|
1
|
|
|
|
|
425
|
sort keys %{ App::clad->new('--server')->alias }; |
|
1
|
|
|
|
|
8
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub run |
43
|
|
|
|
|
|
|
{ |
44
|
5
|
|
|
5
|
1
|
17910
|
my $self = shift; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
ref $self |
47
|
|
|
|
|
|
|
? $self->SUPER::new(@_) |
48
|
5
|
50
|
|
|
|
18
|
: do { |
49
|
5
|
|
|
|
|
248
|
Carp::carp "Class method call of Clustericious::Admin->run is deprecated"; |
50
|
5
|
|
|
|
|
2080
|
my($opts, $cluster, @cmd) = @_; |
51
|
|
|
|
|
|
|
App::clad->new( |
52
|
|
|
|
|
|
|
($opts->{n} ? ('-n') : ()), |
53
|
|
|
|
|
|
|
($opts->{l} ? ('-l' => $opts->{l}) : ()), |
54
|
5
|
100
|
|
|
|
48
|
($opts->{a} ? ('-a') : ()), |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$cluster, @cmd, |
56
|
|
|
|
|
|
|
)->run; |
57
|
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=pod |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=encoding UTF-8 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 NAME |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Clustericious::Admin - Parallel SSH client |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 VERSION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
version 1.10 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SYNOPSIS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
% perldoc clad |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 DESCRIPTION |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This module used to contain the machinery to implement the L<clad> command. |
83
|
|
|
|
|
|
|
This was moved into L<App::clad> when it was rewritten. This module is |
84
|
|
|
|
|
|
|
provided for compatibility. In the future it may provide a Perl level API |
85
|
|
|
|
|
|
|
for L<clad>. It currently provides a deprecated interface which will be |
86
|
|
|
|
|
|
|
removed from a future version, but not before B<January 31, 2015>. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 FUNCTIONS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 banners |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
B<DEPRECATED> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my @banners = Clustericious::Admin->banners; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Returns the banners from the configuration file as a list. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 clusters |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
B<DEPRECATED> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
my @clusters = Clustericious::Admin->clusters; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Returns the list of clusters from the configuration file. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 aliases |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
B<DEPRECATED> |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my @aliases = Clustericious::Admin->aliases; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Returns the alias names from the configuration file as a list. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 run |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
B<DEPRECATED> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Clustericious::Admin->new(\%options, $cluster, $command); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Run the given command on all the hosts in the given cluster. Returns 0. Options |
121
|
|
|
|
|
|
|
is a hash reference which may include any of the following keys. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=over 4 |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item n |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
{ n => 1 } |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Dry run |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item l |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
{ l => $user } |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Set the username that you want to connect with. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item a |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
{ a => 1 } |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Turn off color. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=back |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 CAVEATS |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
L<Clustericious::Admin> and L<clad> require an L<AnyEvent> event loop that allows |
148
|
|
|
|
|
|
|
entering the event loop by calling C<recv> on a condition variable. This is not |
149
|
|
|
|
|
|
|
supported by all L<AnyEvent> event loops and is discouraged by the L<AnyEvent> |
150
|
|
|
|
|
|
|
documentation for CPAN modules, though most of the important event loops, such as |
151
|
|
|
|
|
|
|
L<EV> and the pure perl implementation that comes with L<AnyEvent> DO support |
152
|
|
|
|
|
|
|
this behavior. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 SEE ALSO |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=over 4 |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=item L<clad> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=back |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 AUTHOR |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Graham Ollis <plicease@cpan.org> |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Graham Ollis. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
171
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=cut |