mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 11:22:27 +00:00 
			
		
		
		
	Send verbose ouput along with results in 1 callback intead of 2 in invoke_cmd() function - Line #499
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@147 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -504,8 +504,9 @@ sub invoke_cmd { | ||||
|     my $hwtype  = $request->{hwtype}; | ||||
|     my $verbose = $request->{verbose}; | ||||
|     my @exp; | ||||
|     my $verbose_log; | ||||
|     my @outhash; | ||||
|  | ||||
|     | ||||
|     ######################################## | ||||
|     # Direct-attached FSP handler  | ||||
|     ######################################## | ||||
| @@ -525,15 +526,20 @@ sub invoke_cmd { | ||||
|         # Output verbose Perl::LWP  | ||||
|         #################################### | ||||
|         if ( $verbose ) { | ||||
|             my $lwp_log = $exp[3]; | ||||
|             send_msg( $request, $$lwp_log ); | ||||
|             $verbose_log = $exp[3]; | ||||
|  | ||||
|             my %output; | ||||
|             $output{data} = [$$verbose_log]; | ||||
|             unshift @$result, \%output; | ||||
|         } | ||||
|         my $out = $request->{pipe}; | ||||
|         print $out freeze( $result ); | ||||
|         print $out "\nENDOFFREEZE6sK4ci\n"; | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     ######################################## | ||||
|     # HMC and IVM-managed handler | ||||
|     # Connect to list of remote servers | ||||
|     ######################################## | ||||
|     foreach ( split /,/, $host ) { | ||||
| @@ -564,26 +570,34 @@ sub invoke_cmd { | ||||
|     xCAT::PPCcli::disconnect( \@exp ); | ||||
|  | ||||
|     ######################################## | ||||
|     # Output verbose Expect  | ||||
|     # Get verbose Expect output | ||||
|     ######################################## | ||||
|     if ( $verbose ) { | ||||
|         my $expect_log = $exp[6]; | ||||
|         send_msg( $request, $$expect_log ); | ||||
|         $verbose_log = $exp[6]; | ||||
|     } | ||||
|     ######################################## | ||||
|     # Return error | ||||
|     ########################################  | ||||
|     if ( ref($result) ne 'ARRAY' ) { | ||||
|         send_msg( $request, $result ); | ||||
|         send_msg( $request, $$verbose_log.$result ); | ||||
|         return; | ||||
|     } | ||||
|     ######################################## | ||||
|     # Prepend verbose output  | ||||
|     ######################################## | ||||
|     if ( defined( $verbose_log )) { | ||||
|         my %output; | ||||
|         $output{data} = [$$verbose_log]; | ||||
|         push @outhash, \%output; | ||||
|     } | ||||
|     ######################################## | ||||
|     # Send result back to parent process | ||||
|     ######################################## | ||||
|     if ( @$result[0] eq "FORMATDATA6sK4ci" ) { | ||||
|         shift(@$result); | ||||
|         my $out = $request->{pipe}; | ||||
|         print $out freeze( [@$result] ); | ||||
|  | ||||
|         push @outhash, @$result[1]; | ||||
|         print $out freeze( [@outhash] ); | ||||
|         print $out "\nENDOFFREEZE6sK4ci\n"; | ||||
|         return; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user