Skip to content

Commit

Permalink
Move the vSphere platform renaming logic to the vSphere plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
pnguyen committed Jun 29, 2010
1 parent 0166738 commit 878ee67
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions hqu/hqapi1/app/ResourceController.groovy
Expand Up @@ -578,10 +578,6 @@ class ResourceController extends ApiController {
return config.size() == 0;
}

private generateVSpherePlatformName(name, fqdn) {
return name + " (" + fqdn + ")"
}

private syncResource(xmlResource, parent) {

def id = xmlResource.'@id'?.toInteger()
Expand Down Expand Up @@ -644,18 +640,6 @@ class ResourceController extends ApiController {
def fqdn = xmlResource['ResourceInfo'].find { it.'@key' == PROP_FQDN }
if (fqdn) {
resource = resourceHelper.find('byFqdn':fqdn.'@value')

// Automatically rename vSphere platforms to ensure uniqueness
if (!resource && prototype.isVSpherePlatformPrototype()) {
// check to see if the platform name is already used
def anotherPlatformWithSameName = resourceHelper.find('platform':name)

if (anotherPlatformWithSameName) {
def uniqueName = generateVSpherePlatformName(name, fqdn.'@value')
name = uniqueName
config.name = uniqueName
}
}
} else {
resource = resourceHelper.find('platform':name)
}
Expand All @@ -673,26 +657,6 @@ class ResourceController extends ApiController {
config.put(PROP_FQDN, fqdn.'@value')
}

// Automatically rename vSphere platforms to ensure uniqueness
if (prototype.isVSpherePlatformPrototype()) {
def uniqueName = generateVSpherePlatformName(name, fqdn.'@value')
if (resource.name.equals(uniqueName)) {
// platform was previously automatically renamed,
// so keep using that name
name = uniqueName
config.name = uniqueName
} else {
// check to see if the new platform name is already used
def platformWithSameName = resourceHelper.find('platform':name)

if (platformWithSameName != null
&& platformWithSameName.id != resource.id) {
name = uniqueName
config.name = uniqueName
}
}
}

// Add agent info
def xmlAgent = xmlResource['Agent']
if (xmlAgent) {
Expand Down

0 comments on commit 878ee67

Please sign in to comment.