mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	Add code to support display of hostname using rspconfig
This commit is contained in:
		| @@ -583,7 +583,7 @@ sub parse_args { | ||||
|                 } | ||||
|                 $setorget = "set"; | ||||
|                 if (ref($check) eq "ARRAY") { return $check; } | ||||
|             } elsif ($subcommand =~ /^ip$|^netmask$|^gateway$|^vlan$/) { | ||||
|             } elsif ($subcommand =~ /^ip$|^netmask$|^gateway$|^hostname$|^vlan$/) { | ||||
|                 return ([ 1, "Can not configure and display nodes' value at the same time" ]) if ($setorget and $setorget eq "set"); | ||||
|                 $setorget = "get"; | ||||
|                 if (ref($check) eq "ARRAY") { return $check; } | ||||
| @@ -794,7 +794,7 @@ sub parse_command_status { | ||||
|     if ($command eq "rspconfig") { | ||||
|         my @options = (); | ||||
|         foreach $subcommand (@$subcommands) { | ||||
|             if ($subcommand =~ /^ip$|^netmask$|^gateway$|^vlan$/) { | ||||
|             if ($subcommand =~ /^ip$|^netmask$|^gateway$|^hostname$|^vlan$/) { | ||||
|                 $next_status{LOGIN_RESPONSE} = "RSPCONFIG_GET_REQUEST"; | ||||
|                 $next_status{RSPCONFIG_GET_REQUEST} = "RSPCONFIG_GET_RESPONSE"; | ||||
|                 push @options, $subcommand; | ||||
| @@ -1615,6 +1615,7 @@ sub rspconfig_response { | ||||
|         my $gateway         = "n/a"; | ||||
|         my $prefix          = "n/a"; | ||||
|         my $vlan            = "n/a"; | ||||
|         my $hostname        = ""; | ||||
|         my $default_gateway = "n/a"; | ||||
|         my $adapter_id      = "n/a"; | ||||
|         my $error; | ||||
| @@ -1628,6 +1629,9 @@ sub rspconfig_response { | ||||
|                 if (defined($content{DefaultGateway}) and $content{DefaultGateway}) { | ||||
|                     $default_gateway = $content{DefaultGateway}; | ||||
|                 } | ||||
|                 if (defined($content{HostName}) and $content{HostName}) { | ||||
|                     $hostname = $content{HostName}; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|  | ||||
| @@ -1673,6 +1677,9 @@ sub rspconfig_response { | ||||
|             if ($grep_string =~ "vlan") { | ||||
|                 push @output, "BMC VLAN ID enabled: $vlan"; | ||||
|             } | ||||
|             if ($grep_string =~ "hostname") { | ||||
|                 push @output, "BMC Hostname: $hostname"; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         xCAT::SvrUtils::sendmsg("$_", $callback, $node) foreach (@output); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user