3.5.4.2 Python

According to the WSDL, the method used to discover a server is:

serverDiscover(xs:string serverName, 
   xs:string agentPassword, xs:boolean takeOwnership, )

This process is straightforward, using suds. Simply call the serverDiscover method from directly within your Python script and populate the values that the method expects:

job=client.service.serverDiscover('1.example.com', 'p4ssword','true')

If the API accepts the request, the SOAP response returned contains information about the job that has been created to carry out the process requested. To see the job information, returned do:

print job

The following typical output is returned:

(job){
   generation = 0
   id = 
      (id){
         name = "Server Discover"
         type = "com.oracle.ovm.mgr.ws.model.Job"
         uri = "https://localhost:7002/ovm/core/wsapi/rest/Job/1362504787662"
         value = "1362504787662"
      }
   locked = False
   done = False
   jobGroup = False
   jobRunState = "NONE"
   jobSummaryState = "NONE"
   summaryDone = False
 }

You can easily use the job ID from the response data to track job status with the wait_for_job function:

sid=wait_for_job(client,job.id)