-
Notifications
You must be signed in to change notification settings - Fork 220
Open
Labels
bugConfirmed bugsConfirmed bugs
Description
Describe the bug
When using an IPv6 as a server entry, the hostname/port is not parsed correctly (see rex -d output below). For example, with 2001:db8::1 it uses 2001 as the host and db8 as the port.
Expected behavior
I expect it to use 2001:db8::1 as the address and 23 as the port (default).
How to reproduce it
A code sample to reproduce the issue is attached.
Code example
use Rex -feature => [ '1.4', 'exec_autodie' ];
group myservers => '2001:db8::1';
task 'uptime', group => 'myservers', sub { run 'uptime'; };Additional context
rex -d logs
me@mymachine rextest % rex -d uptime
[2023-06-03 19:03:42] DEBUG - This is Rex version: 1.14.2
[2023-06-03 19:03:42] DEBUG - Command Line Parameters
[2023-06-03 19:03:42] DEBUG - d = 1
[2023-06-03 19:03:42] DEBUG - Creating lock-file (Rexfile.lock)
[2023-06-03 19:03:42] DEBUG - Loading Rexfile
[2023-06-03 19:03:42] DEBUG - Enabling task_chaining_cmdline_args feature
[2023-06-03 19:03:42] DEBUG - Activating new template engine.
[2023-06-03 19:03:42] DEBUG - Disabling usage of a tty
[2023-06-03 19:03:42] DEBUG - Activating autodie.
[2023-06-03 19:03:42] DEBUG - Using Net::OpenSSH if present.
[2023-06-03 19:03:42] DEBUG - Add service check.
[2023-06-03 19:03:42] DEBUG - Setting set() to not append data.
[2023-06-03 19:03:42] DEBUG - Registering CMDB as template variables.
[2023-06-03 19:03:42] DEBUG - activating featureset >= 0.51
[2023-06-03 19:03:42] DEBUG - activating featureset >= 0.40
[2023-06-03 19:03:42] DEBUG - activating featureset >= 0.35
[2023-06-03 19:03:42] DEBUG - activating featureset >= 0.31
[2023-06-03 19:03:42] DEBUG - Enabling exec_autodie
[2023-06-03 19:03:42] DEBUG - Creating new distribution class of type: Base
[2023-06-03 19:03:42] DEBUG - new distribution class of type Rex::TaskList::Base created.
[2023-06-03 19:03:42] DEBUG - Creating task: uptime
[2023-06-03 19:03:42] DEBUG - Found Net::OpenSSH and Net::SFTP::Foreign - using it as default
[2023-06-03 19:03:42] DEBUG - Registering task: uptime
[2023-06-03 19:03:42] DEBUG - Initializing Logger from parameters found in Rexfile
[2023-06-03 19:03:42] DEBUG - Returning existing distribution class of type: Rex::TaskList::Base
[2023-06-03 19:03:42] DEBUG - Returning existing distribution class of type: Rex::TaskList::Base
[2023-06-03 19:03:42] INFO - Running task uptime on 2001:db8::1
[2023-06-03 19:03:42] DEBUG - Rex::Group::Entry::Server (private_key): returning
[2023-06-03 19:03:42] DEBUG - Rex::Group::Entry::Server (public_key): returning
[2023-06-03 19:03:42] DEBUG - $VAR1 = '';
[2023-06-03 19:03:42] DEBUG - Auth-Information inside Task:
[2023-06-03 19:03:42] DEBUG - public_key => [[]]
[2023-06-03 19:03:42] DEBUG - password => [[%s]]
[2023-06-03 19:03:42] DEBUG - sudo_password => [[**********]]
[2023-06-03 19:03:42] DEBUG - auth_type => [[try]]
[2023-06-03 19:03:42] DEBUG - private_key => [[]]
[2023-06-03 19:03:42] DEBUG - sudo => [[]]
[2023-06-03 19:03:42] DEBUG - user => [[me]]
[2023-06-03 19:03:42] DEBUG - port => [[]]
[2023-06-03 19:03:42] DEBUG - Using Net::OpenSSH for connection
[2023-06-03 19:03:42] DEBUG - Using user: me
[2023-06-03 19:03:42] DEBUG - Connecting to 2001:db8 (me)
[2023-06-03 19:03:42] DEBUG - get_openssh_opt()
[2023-06-03 19:03:42] DEBUG - $VAR1 = {};
[2023-06-03 19:03:42] DEBUG - OpenSSH: key_auth or not defined: 2001:db8 - me
[2023-06-03 19:03:42] DEBUG - OpenSSH options:
[2023-06-03 19:03:42] DEBUG - $VAR1 = [
'2001',
'user',
'me',
'port',
'db8',
'master_opts',
[
'-o',
'ConnectTimeout=2',
'-o',
'LogLevel=QUIET'
],
'default_ssh_opts',
$VAR1->[6]
];
[2023-06-03 19:03:42] DEBUG - OpenSSH constructor options:
[2023-06-03 19:03:42] DEBUG - $VAR1 = {};
[2023-06-03 19:03:42] DEBUG - Trying following auth types:
[2023-06-03 19:03:42] DEBUG - $VAR1 = [
'key',
'pass'
];
Bad port 'db8'
Bad port 'db8'
Bad port 'db8'
Bad port 'db8'
Bad port 'db8'
Bad port 'db8'
[2023-06-03 19:03:42] WARN - Can't authenticate against 2001 (unable to establish master SSH connection: master process exited unexpectedly)
[2023-06-03 19:03:42] DEBUG - Connections in queue: 1
[2023-06-03 19:03:42] DEBUG - Destroying all cached os information
[2023-06-03 19:03:43] DEBUG - Waiting for children to finish
[2023-06-03 19:03:43] DEBUG - Need to reinitialize connections.
[2023-06-03 19:03:43] DEBUG - Returning existing distribution class of type: Rex::TaskList::Base
[2023-06-03 19:03:43] ERROR - 1 out of 1 task(s) failed:
[2023-06-03 19:03:43] ERROR - uptime failed on 2001:db8::1
[2023-06-03 19:03:43] ERROR - Couldn't authenticate against 2001:db8::1. It may be caused by one or more of:
[2023-06-03 19:03:43] ERROR - - wrong username, password, key or passphrase
[2023-06-03 19:03:43] ERROR - - changed remote host key
[2023-06-03 19:03:43] ERROR - at /Users/me/perl5/lib/perl5/Rex/TaskList/Base.pm line 340.
[2023-06-03 19:03:43] DEBUG - Removing lockfile
[2023-06-03 19:03:43] DEBUG - Returning existing distribution class of type: Rex::TaskList::BaseMy suspicion is that the error lies here
| ( $server, $port ) = Rex::Helper::IP::get_server_and_port( $server, $port ); |
Rex::Helper::IP::get_server_and_port expects a string for the $server but gets a server entry object instead which makes all the is_ip functions inside get_server_and_port fail. Maybe passing "$server" would solve the issue?
Rex version
(R)?ex 1.14.2
Perl version
This is perl 5, version 30, subversion 3 (v5.30.3) built for darwin-thread-multi-2level
Operating system running rex
macOS 12.0.1 (21A559)
Operating system managed by rex
none
How rex was installed?
cpan client
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugConfirmed bugsConfirmed bugs