Question : Unable tp pass variable in AdminTask object

Hi,

I am running a jacl script to create a certificate request in the keystore (key.p12) and while creating a certificate request I want to pass a variable for the parameter as "-certificateCommonName $host".

So, I have run the below commands to retrieve the host name of the machine and stored in a variable called "host".

wsadmin>set ns $AdminConfig getid /Node:AppServ01/
wsadmin>set host $AdminConfig showAttribute $ns hostName
wsadmin>puts "$host"
TESTSERVER01

Now I am using the AdminTask oject to create a certificate request and when I pass the variable "$host" for the parameter -certificateCommonName, its not taking the value of the variable instead its assigning the variable certificateCommonName as $host

wsadmin>$AdminTask createCertificateRequest {-keyStoreName NodeDefaultKeyStore -certificateAlias certReq4 -certificateSize 1024 -certificateCommonName $host -certificateRequestFilePath D:\tempcerts\testCertReq.arm -certificateOrganization IBM}

So, if anyone has faced the similar problems I appreciate your comments and suggestions.

Thanks,

Answer : Unable tp pass variable in AdminTask object

I just love Jacl (Tcl)... not...

First, it is highly unlikely that your node name is AppServ01

To list the configuration IDs for the known/configured servers, you can:

wsadmin>$AdminConfig list "Server"

The output will be 1 line for each server, and will be of the form:

server1(cells//nodes/e>/servers/server1|server.xml#Server_ue#>)

So, when you execute:

wsadmin>set ns $AdminConfig getid /Node:/

The value of should be what is shown/found in the configuration ID from the previous output.

Does this make sense?

So, when I tried doing that command, I got an exception because the in order to perform the assignment, we really had to tell the scripting engine to "execute" or call the getid method of the $AdminConfig scripting object.

To do this, I had to type:

wsadmin>set ns [$AdminConfig getid /Node:/]

where was the actual nodeName value.  Does that make sense?

The output of the preceding command was the value that was assigned to the $ns variable (i.e., the configuration ID of the node in question).

And in order to get the actual hostname into the host variable, I had to:

wsadmin>set host [$AdminConfig showAttribute $ns hostName]

Does that make sense?

So, the question still remains, how to have the value of the host variable in the command.

I was able to:

set options "-keyStoreName NodeDefaultKeyStore -certificateAlias certReq4 eSize 1024 -certificateCommonName $host -certificateRequestFilePath D:/tempcerts/testCertReq.arm -certificateOrganization IBM"

Then, you should be able to do something like:

$AdminTask createCertificateRequest [ $options ]
Random Solutions  
 
programming4us programming4us