diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 3b1f4fdb3..e9b42e12a 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -656,144 +656,6 @@ sub _execute_dsh return @targets_failed; } -#---------------------------------------------------------------------------- - -=head3 - execute_dshservice - - This is the main driver routine for an instance of the dshservice command. - Given the options configured in the $options hash table, the routine - executes the actions specified by the routine - - Arguments: - $options - options hash table describing dshservice configuration options - - Returns: - None - - Globals: - None - - Error: - None - - Example: - - Comments: - -=cut - -sub execute_dshservice -{ - my ($class, $options) = @_; - - if ($$options{'all-valid-contexts'}) - { - scalar(@dsh_valid_contexts) || xCAT::DSHCLI->get_valid_contexts; - - foreach my $context (sort(@dsh_valid_contexts)) - { - print STDOUT "$context\n"; - } - } - - my $rsp = {}; - my $result; - if ($$options{'query'}) - { - xCAT::DSHCLI->config_default_context($options); - - if (!(-e "$::CONTEXT_DIR$$options{'context'}.pm")) - { - $rsp->{data}->[0] = " Context: $$options{'context'} not valid."; - xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); - - return ++$result; - } - - if ($$options{'nodes'}) - { - my %resolved_targets = (); - my %unresolved_targets = (); - my %context_targets = (); - my @nodenames; - - xCAT::DSHCLI->resolve_targets($options, \%resolved_targets, - \%unresolved_targets, \%context_targets); - - foreach my $user_node (sort keys(%resolved_targets)) - { - my $properties = $resolved_targets{$user_node}; - my $context = $$properties{context}; - my $node = $$properties{hostname}; - $context->query_node($node); - } - foreach my $user_node (sort keys(%unresolved_targets)) - { - my $properties = $unresolved_targets{$user_node}; - my $context = $$properties{context}; - my $node = $$properties{hostname}; - $context->query_node($node); - } - - } - if ($$options{'defaults'}) - { - scalar(@dsh_valid_contexts) || xCAT::DSHCLI->get_valid_contexts; - - print STDOUT "DefaultContext=$$options{'context'}\n"; - - my $dsh_defaults = xCAT::DSHCLI->get_dsh_defaults; - - foreach my $context (sort keys(%$dsh_defaults)) - { - my $context_defaults = $$dsh_defaults{$context}; - foreach my $key (sort keys(%$context_defaults)) - { - my $key_label = $key; - ($key eq 'RemoteShell') - && ($key_label = 'NodeRemoteShell'); - print STDOUT - "$context:$key_label=$$context_defaults{$key}\n"; - } - } - } - } - - if ($$options{'resolve'}) - { - my %resolved_targets = (); - my %unresolved_targets = (); - my %context_targets = (); - - xCAT::DSHCLI->config_default_context($options); - - if (!(-e "$::CONTEXT_DIR$$options{'context'}.pm")) - { - - $rsp->{data}->[0] = " Context: $$options{'context'} not valid."; - xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); - return ++$result; - } - - xCAT::DSHCLI->resolve_targets($options, \%resolved_targets, - \%unresolved_targets, \%context_targets); - - my @targets = (sort keys(%resolved_targets)); - push @targets, (sort keys(%unresolved_targets)); - - foreach my $target (@targets) - { - print STDOUT "$target\n"; - } - } - - if ($$options{'show-config'}) - { - xCAT::DSHCLI->show_dsh_config($options); - } - -} #----------------------------------------------------------------------------