Information
Unsupported content This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

Component - componentKeyToName


Component - componentKeyToName

Description :

This command finds the name of a component based on the handle of the component.

This command is useful when you want to find a particular component and multiple components based on the same component template exist on the same server.

Return type : String

Command Input :

Variable Name

Variable Type

Description

componentKey

com.bladelogic.om.infra.model.base.keys.SComponentKey

Handle of the component that you want to find.

Example

When more then one component based on the same component template exists on the same server, it is possible to locate a particular component by combining the command getAllComponentKeysByTemplateKeyAndServerId with this command.

The following NSH script locates the handle of a component named "apache_QA" on the server "linuxApp1" for the template "ApacheWebServer."

Script





TEMPLATE_KEY=-- Previously retrieved template key --

SERVER_ID=-- Previously retrieved server ID --

COMPONENT_KEY_LIST=`blcli Component  [getAllComponentKeysByTemplateKeyAndServerId|Component - getAllComponentKeysByTemplateKeyAndServerId] $TEMPLATE_KEY $SERVER_ID`

echo "Component Key List is $COMPONENT_KEY_LIST"

echo "$COMPONENT_KEY_LIST" |

while read COMPONENT_KEY

do  echo "Component Key: $COMPONENT_KEY"

COMPONENT_NAME=`blcli Component componentKeyToName $COMPONENT_KEY`

echo "Component Name: $COMPONENT_NAME"

if [ "$COMPONENT_NAME" = "apache_qa" ]

then  NEEDED_COMPONENT_KEY=$COMPONENT_KEY

break

fi

done



 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC Server Automation Command Line Interface 8.5