App-ClusterSSH
view release on metacpan or search on metacpan
lib/App/ClusterSSH.pm view on Meta::CPAN
# 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->{comms} eq 'ssh' ) {
if ( defined $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
if ( $self->options->options );
}
}
$self->config->{terminal_args} = $self->options->term_args
if ( $self->options->term_args );
if ( $self->config->{terminal_args} =~ /-class (\w+)/ ) {
$self->config->{terminal_allow_send_events}
= "-xrm '$1.VT100.allowSendEvents:true'";
}
# if the user has asked for natural sorting we need to include an extra
# module
if ( $self->config()->{'use_natural_sort'} ) {
eval { Module::Load::load('Sort::Naturally'); };
if ($@) {
warn(
"natural sorting requested but unable to load Sort::Naturally: $@\n"
);
}
else {
$sort = sub { Sort::Naturally::nsort(@_) };
}
}
$self->config->dump() if ( $self->options->dump_config );
$self->evaluate_commands() if ( $self->options->evaluate );
$self->get_font_size();
$self->load_keyboard_map();
# read in normal cluster files
$self->config->{extra_cluster_file} .= ',' . $self->options->cluster_file
if ( $self->options->cluster_file );
$self->config->{extra_tag_file} .= ',' . $self->options->tag_file
if ( $self->options->tag_file );
$self->cluster->get_cluster_entries( split /,/,
$self->config->{extra_cluster_file} || '' );
$self->cluster->get_tag_entries( split /,/,
$self->config->{extra_tag_file} || '' );
if ( defined $self->options->list ) {
my $eol = $self->options->quiet ? ' ' : $/;
my $tab = $self->options->quiet ? '' : "\t";
if ( !$self->options->list ) {
print( 'Available cluster tags:', $/ )
unless ( $self->options->quiet );
print $tab, $_, $eol
foreach ( sort( $self->cluster->list_tags ) );
my @external_clusters = $self->cluster->list_external_clusters;
if (@external_clusters) {
print( 'Available external command tags:', $/ )
unless ( $self->options->quiet );
print $tab, $_, $eol foreach ( sort(@external_clusters) );
print $/;
}
}
else {
print 'Tag resolved to hosts: ', $/
unless ( $self->options->quiet );
@servers = $self->resolve_names( $self->options->list );
foreach my $svr (@servers) {
print $tab, $svr, $eol;
}
print $/;
}
$self->debug(
4,
"Full clusters dump: ",
$self->_dump_args_hash( $self->cluster->dump_tags )
);
$self->exit_prog();
}
if (@ARGV) {
@servers = $self->resolve_names(@ARGV);
}
else {
#if ( my @default = $self->cluster->get_tag('default') ) {
if ( $self->cluster->get_tag('default') ) {
@servers
# = $self->resolve_names( @default );
= $self->resolve_names( $self->cluster->get_tag('default') );
}
}
$self->create_windows();
$self->create_menubar();
$self->change_main_window_title();
$self->debug( 2, "Capture map events" );
$self->capture_map_events();
$self->debug( 0, 'Opening to: ', join( ' ', @servers ) )
if ( @servers && !$self->options->quiet );
$self->open_client_windows(@servers);
# Check here if we are tiling windows. Here instead of in func so
# can be tiled from console window if wanted
if ( $self->config->{window_tiling} eq "yes" ) {
$self->retile_hosts();
}
else {
$self->show_console();
}
$self->build_hosts_menu();
$self->debug( 2, "Sleeping for a mo" );
select( undef, undef, undef, 0.5 );
$self->debug( 2, "Sorting focus on console" );
$windows{text_entry}->focus();
$self->debug( 2, "Marking main window as user positioned" );
$windows{main_window}->positionfrom('user')
; # user puts it somewhere, leave it there
# set up external command pipe
( run in 0.507 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )