Re: Any way to allow recert for agent through a script? (293 Views)
Reply
Valued Contributor
Posts: 114
Registered: ‎03-02-2010
Message 1 of 5 (315 Views)
Accepted Solution

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
Respected Contributor
Posts: 54
Registered: ‎08-03-2012
Message 2 of 5 (297 Views)

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

Valued Contributor
Posts: 114
Registered: ‎03-02-2010
Message 3 of 5 (295 Views)

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

Respected Contributor
Posts: 54
Registered: ‎08-03-2012
Message 4 of 5 (293 Views)

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. :)

 

Valued Contributor
Posts: 114
Registered: ‎03-02-2010
Message 5 of 5 (290 Views)

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.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.