Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[HHQ-4058] Also update the agent when syncing platforms

  • Loading branch information...
commit a103252186de0a52d4b2cc9a6b5861ae88162aab 1 parent 3c4a222
pnguyen authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 hqu/hqapi1/app/ResourceController.groovy
View
14 hqu/hqapi1/app/ResourceController.groovy
@@ -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) {
@@ -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

0 comments on commit a103252

Please sign in to comment.
Something went wrong with that request. Please try again.