Ensure ssh_args in config file is honored

Because the default value is defined for --options parameter, the config file value was always overwritten

Only use --options if config file option is not defined and --options is not the default value
This commit is contained in:
Duncan Ferguson 2014-09-19 23:01:41 +01:00
parent 26e783be1c
commit 8aaea928d7
3 changed files with 34 additions and 20 deletions

View file

@ -1,6 +1,7 @@
4.03_03 0000-00-00 Duncan Ferguson <duncan_ferguson@user.sf.net> 4.03_03 0000-00-00 Duncan Ferguson <duncan_ferguson@user.sf.net>
- Force tests to have English locale when user has something else set (Github issue: 10) (thanks to Emanuele Tomasi) - Force tests to have English locale when user has something else set (Github issue: 10) (thanks to Emanuele Tomasi)
- Skip permissions check test when run as root as the results are invalid (Github issue: 11) (thanks to Deny Dias) - Skip permissions check test when run as root as the results are invalid (Github issue: 11) (thanks to Deny Dias)
- Ensure config file option for ssh_args is not lost when options is not used on command line (Github issue: 14)
4.03_02 2014-08-10 Duncan Ferguson <duncan_ferguson@user.sf.net> 4.03_02 2014-08-10 Duncan Ferguson <duncan_ferguson@user.sf.net>
- Fix behaviour when external cluster command is not defined or doesn't exist - Fix behaviour when external cluster command is not defined or doesn't exist

View file

@ -5,7 +5,7 @@ use warnings;
use strict; use strict;
use version; our $VERSION = version->new('4.03_03'); use version; our $VERSION = version->new('4.03_03');
use Carp; use Carp qw/cluck/;
use base qw/ App::ClusterSSH::Base /; use base qw/ App::ClusterSSH::Base /;
use App::ClusterSSH::Host; use App::ClusterSSH::Host;
@ -412,8 +412,7 @@ sub resolve_names(@) {
# out entries are not lost # out entries are not lost
my @new_servers; my @new_servers;
eval { eval {
@new_servers @new_servers = $self->cluster->get_external_clusters(@servers);
= $self->cluster->get_external_clusters( @servers );
}; };
if ($@) { if ($@) {
@ -703,6 +702,7 @@ sub open_client_windows(@) {
} }
if ( $servers{$server}{pid} == 0 ) { if ( $servers{$server}{pid} == 0 ) {
# this is the child # this is the child
# Since this is the child, we can mark any server unresolved without # Since this is the child, we can mark any server unresolved without
# affecting the main program # affecting the main program
@ -1468,8 +1468,7 @@ sub create_windows() {
if ( $self->config->{max_addhost_menu_cluster_items} if ( $self->config->{max_addhost_menu_cluster_items}
&& scalar @tags ) && scalar @tags )
{ {
if (scalar @tags if ( scalar @tags < $self->config->{max_addhost_menu_cluster_items} )
< $self->config->{max_addhost_menu_cluster_items} )
{ {
$menus{listbox} = $windows{addhost}->Listbox( $menus{listbox} = $windows{addhost}->Listbox(
-selectmode => 'extended', -selectmode => 'extended',
@ -1911,8 +1910,20 @@ sub run {
$self->debug( 2, "VERSION: $VERSION" ); $self->debug( 2, "VERSION: $VERSION" );
# only use ssh_args from options if config file ssh_args not set AND
# options is not the default value otherwise the default options
# value is used instead of the config file
if ( $self->config->{ssh_args} ) {
if ( $self->options->options
&& $self->options->options ne $self->options->options_default )
{
$self->config->{ssh_args} = $self->options->options;
}
}
else {
$self->config->{ssh_args} = $self->options->options $self->config->{ssh_args} = $self->options->options
if ( $self->options->options ); if ( $self->options->options );
}
$self->config->{terminal_args} = $self->options->term_args $self->config->{terminal_args} = $self->options->term_args
if ( $self->options->term_args ); if ( $self->options->term_args );

View file

@ -307,6 +307,8 @@ sub getopts {
# ? $self->{command_options}->{$acc}->{default} # ? $self->{command_options}->{$acc}->{default}
# : undef; # : undef;
}; };
my $accessor_default=$accessor.'_default';
*$accessor_default = sub { return $default; };
} }
} }