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   1563 use v5.12.5;
  67         354  
8 67     67   523 use warnings;
  67         299  
  67         4085  
9              
10             our $VERSION = '1.14.2.3'; # TRIAL VERSION
11              
12 67     67   915 use Rex::Interface::Connection::Base;
  67         290  
  67         932  
13 67     67   2729 use Rex::Group::Entry::Server;
  67         304  
  67         1120  
14              
15 67     67   2721 use base qw(Rex::Interface::Connection::Base);
  67         260  
  67         28165  
16              
17             sub new {
18 101     101 0 393 my $that = shift;
19 101   33     802 my $proto = ref($that) || $that;
20 101         763 my $self = $that->SUPER::new(@_);
21              
22 101         934 $self->{server} = Rex::Group::Entry::Server->new( name => "" );
23              
24 101         325 bless( $self, $proto );
25              
26 101         461 return $self;
27             }
28              
29       0 0   sub error { }
30       34 0   sub connect { }
31       27 0   sub disconnect { }
32 210     210 0 823 sub get_connection_object { my ($self) = @_; return $self; }
  210         2164  
33 0     0 0 0 sub get_fs_connection_object { my ($self) = @_; return $self; }
  0         0  
34 34     34 0 357 sub is_connected { return 1; }
35 34     34 0 170 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 3643     3643 0 9956 my ($self) = @_;
43              
44 3643 50 33     29609 if ( ( $self->{is_sudo} && $self->{is_sudo} == 1 ) || Rex::is_sudo() ) {
      33        
45 0         0 return "Sudo";
46             }
47              
48 3643         14170 return "Local";
49             }
50              
51             1;