Skip to content

Commit

Permalink
[HHQ-4058] Also update the agent when syncing platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
pnguyen committed Jun 17, 2010
1 parent 3c4a222 commit a103252
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions hqu/hqapi1/app/ResourceController.groovy
Expand Up @@ -11,6 +11,7 @@ class ResourceController extends ApiController {
private static final String PROP_FQDN = "fqdn"
private static final String PROP_INSTALLPATH = "installPath"
private static final String PROP_AIIDENIFIER = "autoIdentifier"
private static final String PROP_AGENT_ID = "agentId"

// TODO: move into ResourceCategory
private getLocation(r) {
Expand Down Expand Up @@ -638,6 +639,19 @@ class ResourceController extends ApiController {
} else {
config.put(PROP_FQDN, fqdn.'@value')
}

// Add agent info
def xmlAgent = xmlResource['Agent']
if (xmlAgent) {
def agentId = xmlAgent[0].'@id'?.toInteger()
def agent = getAgent(agentId, null, null)
if (!agent) {
return getFailureXML(ErrorCode.OBJECT_NOT_FOUND ,
"Unable to find agent id=" + agentId)
} else {
config.put(PROP_AGENT_ID, agentId)
}
}
} else if (prototype.isServerPrototype()) {
def aiid = xmlResource['ResourceInfo'].find {
it.'@key' == PROP_AIIDENIFIER
Expand Down

0 comments on commit a103252

Please sign in to comment.