Fix CMDB hostname detection Using server name from 'Rex::get_current_connection()->{conn}->server->to_s' as a host's hostname is unreliable: it can be either FQDN, or IP, or name from the SSH config file. --- ./lib/Rex/CMDB/Base.pm +++ ./lib/Rex/CMDB/Base.pm @@ -34,7 +34,7 @@ sub __get_hostname_for { my $hostname = $server // Rex::get_current_connection()->{conn}->server->to_s; - if ( $hostname eq '' ) { + if ( ($hostname eq '' ) || Rex::is_ssh() ) { my %hw_info = Rex::Hardware->get('Host'); $hostname = $hw_info{Host}{hostname}; }