Fix migration of .csshrc when not working as expected

Debian bug ID #673507
This commit is contained in:
Duncan Ferguson 2013-02-14 21:23:49 +00:00
parent b333641287
commit 42982cb59b
2 changed files with 24 additions and 12 deletions

View file

@ -7,6 +7,7 @@
* Error emitted when adding a host via the "Hosts" drop-down (Debian bug ID #578208)
* Pastes uses a strange keyboard layout (Debian bug ID #364565)
* Cope with being invoked by 'clusterssh' (Debian bug ID #644368)
* Fix migration of .csshrc when not working as expected (Debian bug ID #673507)
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

View file

@ -311,6 +311,29 @@ sub write_user_config_file {
}
}
# Debian #673507 - migrate clusters prior to writing ~/.clusterssh/config
# in order to update the extra_cluster_file property
if (%old_clusters) {
if ( open( my $fh, ">", "$ENV{HOME}/.clusterssh/clusters" ) ) {
print $fh '# '
. $self->loc('Tag definitions moved from old .csshrc file'),
$/;
foreach ( sort( keys(%old_clusters) ) ) {
print $fh $_, ' ', join( ' ', $old_clusters{$_} ), $/;
}
close($fh);
} else {
croak(
App::ClusterSSH::Exception::Config->throw(
error => $self->loc(
'Unable to write [_1]: [_2]' . $/,
'$HOME/.clusterssh/clusters', $!
),
),
);
}
}
if ( open( CONFIG, ">", "$ENV{HOME}/.clusterssh/config" ) ) {
foreach ( sort( keys(%$self) ) ) {
print CONFIG "$_=$self->{$_}\n";
@ -334,18 +357,6 @@ sub write_user_config_file {
);
}
if (%old_clusters) {
if ( open( my $fh, ">", "$ENV{HOME}/.clusterssh/clusters" ) ) {
print $fh '# '
. $self->loc('Tag definitions moved from old .csshrc file'),
$/;
foreach ( sort( keys(%old_clusters) ) ) {
print $fh $_, ' ', join( ' ', $old_clusters{$_} ), $/;
}
close($fh);
}
}
return $self;
}