Add in 'hostname_override' configuration

Add in a new configuration option to override the system hostname
rather than rely on DNS (which may not be correctly configured on
the system)

Github issue #158
This commit is contained in:
Duncan Ferguson 2024-10-14 21:37:38 +01:00
parent 4188dc980f
commit 46c9bfc067
5 changed files with 10 additions and 2 deletions

View file

@ -4,6 +4,7 @@ require Module::Build;
my %module_build_args = (
module_name => 'App::ClusterSSH',
dist_abstract => "Cluster administration tool",
##{ $plugin->get_prereqs(1) ##}
##{ $plugin->get_default('share_dir') ##}
script_files => [

View file

@ -1,5 +1,8 @@
Revision history for {{$dist->name}}
4.17_01 ????-??-?? Duncan Ferguson <duncan_ferguson@user.sf.net>
- Swap the hostname lookup macro from DNS to using the system hostname (Github issue #158)
4.16 2020-06-20 Duncan Ferguson <duncan_ferguson@user.sf.net>
- Further fix for 'resolve_names' error when adding hosts via the UI
- Fix missing space separator for ssh_args (thanks to Petr Vorel)

View file

@ -118,6 +118,7 @@ my %default_config = (
macro_user_2_command => '',
macro_user_3_command => '',
macro_user_4_command => '',
hostname_override => '',
max_addhost_menu_cluster_items => 6,
menu_send_autotearoff => 0,

View file

@ -10,7 +10,7 @@ use English qw( -no_match_vars );
use base qw/ App::ClusterSSH::Base /;
use vars qw/ %keysymtocode %keycodetosym /;
use Net::Domain qw(hostfqdn);
use Sys::Hostname qw/ hostname /;
use File::Temp qw/:POSIX/;
use Fcntl;
use POSIX ":sys_wait_h";
@ -601,7 +601,7 @@ sub substitute_macros {
}
{
my $macro_hostname = $self->config->{macro_hostname};
my $hostname = hostfqdn();
my $hostname = $self->config->{hostname_override} || hostname();
$text =~ s!$macro_hostname!$hostname!xsmg;
$ENV{CSSH_HOSTNAME} = $hostname;
}

View file

@ -101,6 +101,8 @@ Readonly::Hash my %default_config => {
history_width => 40,
history_height => 10,
hostname_override => '',
command => q{},
command_pre => q{},
command_post => q{},
@ -580,6 +582,7 @@ fillscreen=no
hide_menu=0
history_height=10
history_width=40
hostname_override=
key_addhost=Control-Shift-plus
key_clientname=Alt-n
key_history=Alt-h