Server Automation Practitioners Forum
cancel

Any way to allow recert for agent through a script?

SOLVED
Go to solution
Dimiter Todorov
Honored Contributor.

Any way to allow recert for agent through a script?

I have been trying to find out how to allow recert for certain agents through the twist. I thouhgt I could use the Twist, but apparently not.

 

I have tried to use this code, even though the AgentCryptoVO reports as allowRecert=true. After inspecting the parent Server object, that is not the case.

 

(custom function called find_server_vos_by_filter ; returns array of server_vos)

 

 

this_svr=my_sas_client.server_service.find_server_vos_by_filter("(ServerVO.opswLifecycle NOT_EQUAL_TO DEACTIVATED)&(device_customer_name IN UNKNOWN CUSTOMER1)&(ServerVO.state EQUAL_TO UNREACHABLE)")
this_svr.each do |svr|
  agent_cvo=my_sas_client.server_service.getAgentCryptoInfoVO(svr.get_ref)
  if agent_cvo.is_allow_recert == false
 
    agent_cvo.set_allow_recert(true)
  end
  puts "#{svr.short_host_name},#{agent_cvo.is_allow_recert},#{agent_cvo.getCert1Date}"
 
end
4 REPLIES
sjmh
Honored Contributor.

Re: Any way to allow recert for agent through a script?

To update the Truth with the new VO, you have to assign the AgentCryptoInfoVO back to the ServerVO, then call the ServerService.update method with the ServerRef and ServerVO

Dimiter Todorov
Honored Contributor.

Re: Any way to allow recert for agent through a script?

How can I assign the crypto vo to the servervo. I don't see that as a function or attribute for ServerVO.

 

D

Highlighted
sjmh
Honored Contributor.
Solution

Re: Any way to allow recert for agent through a script?

Ah, looks like you can't.

 

You can try and do this thru spin instead:

 

import sys
sys.path.append('/opt/opsware/pylibs2')
from coglib import spinwrapper
spin = spinwrapper.SpinWrapper("http://127.0.0.1:1007")
server_mid = 123456
spin.Device.update(id = server_mid, allow_recert=1)

 You can set it to 1 or 0, not sure which means which in this case, but assuming 1 is True. :)

 

Dimiter Todorov
Honored Contributor.

Re: Any way to allow recert for agent through a script?

Thanks, That works. I would love to see it in the twist some day.