mirror of
https://github.com/duncs/clusterssh.git
synced 2025-04-21 09:09:06 +00:00
Added '--use_all_a_records'
If a hostname resolves to multiple IP addresses, allow to connect to all of them, not just the first one found. Thanks to Simon Fraser
This commit is contained in:
parent
198c8bc2ab
commit
bb9237d888
4 changed files with 36 additions and 0 deletions
1
Changes
1
Changes
|
@ -2,6 +2,7 @@
|
|||
* Fix test error on 5.8.8 (reported by Wei Wang)
|
||||
* Added '--list', '-L' to list available cluster tags (idea from Markus Manzke)
|
||||
* Fix terminal size only set on last windows (Sf bug 3061999)
|
||||
* Added '--use_all_a_records' (Simon Fraser)
|
||||
|
||||
2010-06-20 Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.00_05
|
||||
|
||||
|
|
1
THANKS
1
THANKS
|
@ -36,3 +36,4 @@ Ian Marsh
|
|||
Roland Rosenfeld
|
||||
Wei Wang
|
||||
Markus Manzke
|
||||
Simon Fraser
|
||||
|
|
10
bin/cssh
10
bin/cssh
|
@ -208,6 +208,11 @@ Enable|Disable window tiling (overriding the config file)
|
|||
|
||||
Specify the initial part of the title used in the console and client windows
|
||||
|
||||
=item --use_all_a_records,-A
|
||||
|
||||
If a hostname resolves to multiple IP addresses, toggle whether or not to
|
||||
connect to all of them, or just the first one (see also config file entry)
|
||||
|
||||
=item --username,-l $LOGNAME
|
||||
|
||||
Specify the default username to use for connections (if different from the
|
||||
|
@ -539,6 +544,11 @@ This defaults to "no" as it causes some problems with the FVWM window
|
|||
manager. If you are experiencing problems with redraws, you can set it to
|
||||
"yes" to allow the window to be unmapped before it is repositioned.
|
||||
|
||||
=item use_all_a_records = no
|
||||
|
||||
If a hostname resolves to multiple IP addresses, set to C<yes> to connect
|
||||
to all of them, not just the first one found.
|
||||
|
||||
=item use_hotkeys = yes
|
||||
|
||||
Setting to anything other than C<yes> will disable all hotkeys.
|
||||
|
|
|
@ -32,6 +32,7 @@ use Net::hostent;
|
|||
use Carp;
|
||||
use Sys::Hostname;
|
||||
use English;
|
||||
use Socket;
|
||||
|
||||
# Notes on general order of processing
|
||||
#
|
||||
|
@ -88,6 +89,7 @@ my @options_spec = (
|
|||
'output-config|u',
|
||||
'font|f=s',
|
||||
'list|L',
|
||||
'use_all_a_records|A',
|
||||
);
|
||||
my %options;
|
||||
my %config;
|
||||
|
@ -249,6 +251,8 @@ sub load_config_defaults() {
|
|||
$config{menu_host_autotearoff} = 0;
|
||||
|
||||
$config{send_menu_xml_file} = $ENV{HOME} . '/.csshrc_send_menu';
|
||||
|
||||
$config{use_all_a_records} = 0;
|
||||
}
|
||||
|
||||
# load in config file settings
|
||||
|
@ -387,6 +391,10 @@ sub check_config() {
|
|||
$config{show_history} = 1 if $options{'show-history'};
|
||||
|
||||
$config{command} = $options{action} if ( $options{action} );
|
||||
|
||||
if ( $options{use_all_a_records} ) {
|
||||
$config{use_all_a_records} = !$config{use_all_a_records} || 0;
|
||||
}
|
||||
}
|
||||
|
||||
sub load_configfile() {
|
||||
|
@ -705,6 +713,22 @@ sub resolve_names(@) {
|
|||
if ( $dirty =~ s/^(.*)@// ) {
|
||||
$username = $1;
|
||||
}
|
||||
if ( $config{use_all_a_records}
|
||||
&& $dirty !~ m/^(\d{1,3}\.?){4}$/
|
||||
&& !defined( $clusters{$dirty} ) )
|
||||
{
|
||||
my $hostobj = gethostbyname($dirty);
|
||||
if ( defined($hostobj) ) {
|
||||
my @alladdrs = map { inet_ntoa($_) } @{ $hostobj->addr_list };
|
||||
if ( $#alladdrs > 0 ) {
|
||||
$clusters{$dirty} = join ' ', @alladdrs;
|
||||
logmsg( 3, 'Expanded to ', $clusters{$dirty} );
|
||||
}
|
||||
else {
|
||||
logmsg( 3, 'Only one A record' );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $clusters{$dirty} ) {
|
||||
logmsg( 3, '... it is a cluster' );
|
||||
foreach my $node ( split( / /, $clusters{$dirty} ) ) {
|
||||
|
|
Loading…
Add table
Reference in a new issue