File Coverage

lib/Rex/Interface/Connection/Local.pm
Criterion Covered Total %
statement 27 31 87.1
branch 1 2 50.0
condition 3 9 33.3
subroutine 12 15 80.0
pod 0 10 0.0
total 43 67 64.1


line stmt bran cond sub pod time code
1             #
2             # (c) Jan Gehring
3             #
4              
5             package Rex::Interface::Connection::Local;
6              
7 67     67   1465 use v5.12.5;
  67         406  
8 67     67   584 use warnings;
  67         247  
  67         4013  
9              
10             our $VERSION = '1.14.2.2'; # TRIAL VERSION
11              
12 67     67   1053 use Rex::Interface::Connection::Base;
  67         297  
  67         1001  
13 67     67   2800 use Rex::Group::Entry::Server;
  67         237  
  67         1184  
14              
15 67     67   2731 use base qw(Rex::Interface::Connection::Base);
  67         273  
  67         28757  
16              
17             sub new {
18 101     101 0 377 my $that = shift;
19 101   33     819 my $proto = ref($that) || $that;
20 101         792 my $self = $that->SUPER::new(@_);
21              
22 101         855 $self->{server} = Rex::Group::Entry::Server->new( name => "" );
23              
24 101         329 bless( $self, $proto );
25              
26 101         537 return $self;
27             }
28              
29       0 0   sub error { }
30       34 0   sub connect { }
31       27 0   sub disconnect { }
32 211     211 0 1038 sub get_connection_object { my ($self) = @_; return $self; }
  211         2376  
33 0     0 0 0 sub get_fs_connection_object { my ($self) = @_; return $self; }
  0         0  
34 34     34 0 313 sub is_connected { return 1; }
35 34     34 0 169 sub is_authenticated { return 1; }
36              
37             sub get_auth_user {
38 0     0 0 0 return Rex::Config::get_user();
39             }
40              
41             sub get_connection_type {
42 3434     3434 0 9897 my ($self) = @_;
43              
44 3434 50 33     27920 if ( ( $self->{is_sudo} && $self->{is_sudo} == 1 ) || Rex::is_sudo() ) {
      33        
45 0         0 return "Sudo";
46             }
47              
48 3434         13255 return "Local";
49             }
50              
51             1;