File Coverage

blib/lib/Clustericious/Admin.pm
Criterion Covered Total %
statement 29 29 100.0
branch 8 10 80.0
condition n/a
subroutine 8 8 100.0
pod 4 4 100.0
total 49 51 96.0


line stmt bran cond sub pod time code
1             package Clustericious::Admin;
2              
3 3     3   7684 use strict;
  3         5  
  3         127  
4 3     3   13 use warnings;
  3         6  
  3         108  
5 3     3   14 use App::clad;
  3         6  
  3         71  
6 3     3   11 use Carp ();
  3         6  
  3         764  
7              
8             # ABSTRACT: Parallel SSH client
9             our $VERSION = '1.09'; # VERSION
10              
11              
12              
13             sub banners
14             {
15 1     1 1 2407 (undef) = @_;
16 1         20 Carp::carp "Class method call of Clustericious::Admin->banners is deprecated";
17 1         352 ();
18             }
19              
20              
21             sub clusters
22             {
23 1     1 1 2551 my $self = shift;
24            
25             ref $self
26             ? $self->SUPER::new($_)
27 1 50       4 : do {
28 1         11 Carp::carp "Class method call of Clustericious::Admin->clusters is deprecated";
29 1         291 sort keys %{ App::clad->new('--server')->cluster_list };
  1         9  
30             };
31             }
32              
33              
34             sub aliases
35             {
36 1     1 1 3031 (undef) = @_;
37 1         18 Carp::carp "Class method call of Clustericious::Admin->aliases is deprecated";
38 1         324 sort keys %{ App::clad->new('--server')->alias };
  1         7  
39             }
40              
41              
42             sub run
43             {
44 5     5 1 12447 my $self = shift;
45            
46             ref $self
47             ? $self->SUPER::new(@_)
48 5 50       16 : do {
49 5         296 Carp::carp "Class method call of Clustericious::Admin->run is deprecated";
50 5         1405 my($opts, $cluster, @cmd) = @_;
51             App::clad->new(
52             ($opts->{n} ? ('-n') : ()),
53             ($opts->{l} ? ('-l' => $opts->{l}) : ()),
54 5 100       60 ($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.09
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