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   1382 use v5.12.5;
  67         368  
8 67     67   855 use warnings;
  67         273  
  67         4242  
9              
10             our $VERSION = '1.14.3'; # VERSION
11              
12 67     67   920 use Rex::Interface::Connection::Base;
  67         287  
  67         857  
13 67     67   2592 use Rex::Group::Entry::Server;
  67         206  
  67         979  
14              
15 67     67   2654 use base qw(Rex::Interface::Connection::Base);
  67         215  
  67         27348  
16              
17             sub new {
18 101     101 0 378 my $that = shift;
19 101   33     772 my $proto = ref($that) || $that;
20 101         779 my $self = $that->SUPER::new(@_);
21              
22 101         870 $self->{server} = Rex::Group::Entry::Server->new( name => "" );
23              
24 101         320 bless( $self, $proto );
25              
26 101         413 return $self;
27             }
28              
29       0 0   sub error { }
30       34 0   sub connect { }
31       27 0   sub disconnect { }
32 210     210 0 674 sub get_connection_object { my ($self) = @_; return $self; }
  210         1942  
33 0     0 0 0 sub get_fs_connection_object { my ($self) = @_; return $self; }
  0         0  
34 34     34 0 290 sub is_connected { return 1; }
35 34     34 0 199 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 8496 my ($self) = @_;
43              
44 3643 50 33     26018 if ( ( $self->{is_sudo} && $self->{is_sudo} == 1 ) || Rex::is_sudo() ) {
      33        
45 0         0 return "Sudo";
46             }
47              
48 3643         13210 return "Local";
49             }
50              
51             1;