Reinstate 'user' config option

Add 'user=' back into the config file
Add newlines for some error messages
This commit is contained in:
Duncan Ferguson 2013-02-13 17:50:26 +00:00
parent 1bcba455c3
commit 9695b3a4f0
4 changed files with 22 additions and 15 deletions

View file

@ -1,5 +1,7 @@
????-??-?? Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.01_03 ????-??-?? Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.01_03
* Correct documentation for references to $HOME/.clusterssh/config * Correct documentation for references to $HOME/.clusterssh/config
* Re-add user back into the configurartion file
* Add in missing newline for some error messages
2012-12-09 Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.01_02 2012-12-09 Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.01_02
* Fix logic when using 'autoclose' on the command line or config file * Fix logic when using 'autoclose' on the command line or config file

View file

@ -19,6 +19,7 @@ MANIFEST
MANIFEST.SKIP MANIFEST.SKIP
META.yml META.yml
MYMETA.json MYMETA.json
MYMETA.yml
README README
t/00-load.t t/00-load.t
t/01l10n.t t/01l10n.t

View file

@ -76,6 +76,8 @@ my %default_config = (
use_all_a_records => 0, use_all_a_records => 0,
send_menu_xml_file => $ENV{HOME} . '/.csshrc_send_menu', send_menu_xml_file => $ENV{HOME} . '/.csshrc_send_menu',
user => $ENV{LOGNAME},
); );
sub new { sub new {
@ -136,7 +138,7 @@ sub validate_args {
App::ClusterSSH::Exception::Config->throw( App::ClusterSSH::Exception::Config->throw(
unknown_config => \@unknown_config, unknown_config => \@unknown_config,
error => $self->loc( error => $self->loc(
'Unknown configuration parameters: [_1]', 'Unknown configuration parameters: [_1]'.$/,
join( ',', @unknown_config ) join( ',', @unknown_config )
) )
) )
@ -155,7 +157,7 @@ sub parse_config_file {
croak( croak(
App::ClusterSSH::Exception::Config->throw( App::ClusterSSH::Exception::Config->throw(
error => $self->loc( error => $self->loc(
'File [_1] does not exist or cannot be read', $config_file 'File [_1] does not exist or cannot be read'.$/, $config_file
), ),
), ),
); );
@ -260,7 +262,7 @@ sub write_user_config_file {
croak( croak(
App::ClusterSSH::Exception::Config->throw( App::ClusterSSH::Exception::Config->throw(
error => $self->loc( error => $self->loc(
'Unable to create directory [_1]: [_2]', 'Unable to create directory [_1]: [_2]'.$/,
'$HOME/.clusterssh', $! '$HOME/.clusterssh', $!
), ),
), ),
@ -279,7 +281,7 @@ sub write_user_config_file {
croak( croak(
App::ClusterSSH::Exception::Config->throw( App::ClusterSSH::Exception::Config->throw(
error => $self->loc( error => $self->loc(
'Unable to write default [_1]: [_2]', 'Unable to write default [_1]: [_2]'.$/,
'$HOME/.clusterssh/config', '$HOME/.clusterssh/config',
$! $!
), ),
@ -308,7 +310,7 @@ sub find_binary {
if ( !$binary ) { if ( !$binary ) {
croak( croak(
App::ClusterSSH::Exception::Config->throw( App::ClusterSSH::Exception::Config->throw(
error => $self->loc('argument not provided'), error => $self->loc('argument not provided').$/,
), ),
); );
} }
@ -360,7 +362,7 @@ sub find_binary {
croak( croak(
App::ClusterSSH::Exception::Config->throw( App::ClusterSSH::Exception::Config->throw(
error => $self->loc( error => $self->loc(
'"[_1]" binary not found - please amend $PATH or the cssh config file', '"[_1]" binary not found - please amend $PATH or the cssh config file'.$/,
$binary $binary
), ),
), ),

View file

@ -89,6 +89,7 @@ Readonly::Hash my %default_config => {
debug => 0, debug => 0,
lang => 'en', lang => 'en',
user => $ENV{LOGNAME},
}; };
my %expected = %default_config; my %expected = %default_config;
is_deeply( $config, \%expected, 'default config is correct' ); is_deeply( $config, \%expected, 'default config is correct' );
@ -102,7 +103,7 @@ trap {
}; };
isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' ); isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' );
is( $trap->die, is( $trap->die,
'Unknown configuration parameters: doesnt_exist,whoops', 'Unknown configuration parameters: doesnt_exist,whoops'.$/,
'got correct error message' 'got correct error message'
); );
is_deeply( is_deeply(
@ -135,7 +136,7 @@ trap {
}; };
isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' ); isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' );
is( $trap->die, is( $trap->die,
"File $file does not exist or cannot be read", "File $file does not exist or cannot be read".$/,
'got correct error message' 'got correct error message'
); );
@ -167,7 +168,7 @@ trap {
is( $trap->leaveby, 'die', 'died ok' ); is( $trap->leaveby, 'die', 'died ok' );
isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' ); isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' );
is( $trap->die, is( $trap->die,
'Unknown configuration parameters: missing,rubbish', 'Unknown configuration parameters: missing,rubbish'.$/,
'die message correct' 'die message correct'
); );
isa_ok( $config, "App::ClusterSSH::Config" ); isa_ok( $config, "App::ClusterSSH::Config" );
@ -198,7 +199,7 @@ trap {
is( $trap->leaveby, 'die', 'died ok' ); is( $trap->leaveby, 'die', 'died ok' );
isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' ); isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' );
isa_ok( $config, "App::ClusterSSH::Config" ); isa_ok( $config, "App::ClusterSSH::Config" );
is( $trap->die, 'argument not provided', 'die message correct' ); is( $trap->die, 'argument not provided'.$/, 'die message correct' );
isa_ok( $config, "App::ClusterSSH::Config" ); isa_ok( $config, "App::ClusterSSH::Config" );
is( $trap->stdout, q{}, 'Expecting no STDOUT' ); is( $trap->stdout, q{}, 'Expecting no STDOUT' );
is( $trap->stderr, q{}, 'Expecting no STDERR' ); is( $trap->stderr, q{}, 'Expecting no STDERR' );
@ -211,7 +212,7 @@ is( $trap->leaveby, 'die', 'died ok' );
isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' ); isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' );
isa_ok( $config, "App::ClusterSSH::Config" ); isa_ok( $config, "App::ClusterSSH::Config" );
is( $trap->die, is( $trap->die,
'"missing" binary not found - please amend $PATH or the cssh config file', '"missing" binary not found - please amend $PATH or the cssh config file'.$/,
'die message correct' 'die message correct'
); );
isa_ok( $config, "App::ClusterSSH::Config" ); isa_ok( $config, "App::ClusterSSH::Config" );
@ -396,7 +397,7 @@ is( $trap->leaveby, 'die', 'died ok' );
isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' ); isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' );
isa_ok( $config, "App::ClusterSSH::Config" ); isa_ok( $config, "App::ClusterSSH::Config" );
is( $trap->die, is( $trap->die,
'Unable to create directory $HOME/.clusterssh: File exists', 'Unable to create directory $HOME/.clusterssh: File exists'.$/,
'die message correct' 'die message correct'
); );
isa_ok( $config, "App::ClusterSSH::Config" ); isa_ok( $config, "App::ClusterSSH::Config" );
@ -415,7 +416,7 @@ is( $trap->leaveby, 'die', 'died ok' );
isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' ); isa_ok( $trap->die, 'App::ClusterSSH::Exception::Config' );
isa_ok( $config, "App::ClusterSSH::Config" ); isa_ok( $config, "App::ClusterSSH::Config" );
is( $trap->die, is( $trap->die,
'Unable to write default $HOME/.clusterssh/config: Is a directory', 'Unable to write default $HOME/.clusterssh/config: Is a directory'.$/,
'die message correct' 'die message correct'
); );
isa_ok( $config, "App::ClusterSSH::Config" ); isa_ok( $config, "App::ClusterSSH::Config" );
@ -435,7 +436,7 @@ is( $trap->leaveby, 'return', 'died ok' );
isa_ok( $config, "App::ClusterSSH::Config" ); isa_ok( $config, "App::ClusterSSH::Config" );
is( $trap->stdout, q{}, 'Expecting no STDOUT' ); is( $trap->stdout, q{}, 'Expecting no STDOUT' );
is( $trap->stderr, is( $trap->stderr,
q{Unable to create directory $HOME/.clusterssh: File exists} . $/, q{Unable to create directory $HOME/.clusterssh: File exists} . $/ . $/,
'Expecting no STDERR' 'Expecting no STDERR'
); );
@ -452,7 +453,7 @@ isa_ok( $config, "App::ClusterSSH::Config" );
isa_ok( $config, "App::ClusterSSH::Config" ); isa_ok( $config, "App::ClusterSSH::Config" );
is( $trap->stdout, q{}, 'Expecting no STDOUT' ); is( $trap->stdout, q{}, 'Expecting no STDOUT' );
is( $trap->stderr, is( $trap->stderr,
q{Unable to write default $HOME/.clusterssh/config: Is a directory} . $/, q{Unable to write default $HOME/.clusterssh/config: Is a directory} . $/ . $/,
'Expecting no STDERR' 'Expecting no STDERR'
); );
@ -508,6 +509,7 @@ terminal_title_opt=-T
unmap_on_redraw=no unmap_on_redraw=no
use_all_a_records=0 use_all_a_records=0
use_hotkeys=yes use_hotkeys=yes
user=} . $ENV{LOGNAME} . qq{
window_tiling=yes window_tiling=yes
window_tiling_direction=right window_tiling_direction=right
}; };