Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move the vSphere platform renaming logic to the vSphere plugin

  • Loading branch information...
commit 878ee678b6105fa4302ecb0ee813ed6a924ec3bc 1 parent 0166738
pnguyen authored
Showing with 0 additions and 36 deletions.
  1. +0 −36 hqu/hqapi1/app/ResourceController.groovy
36 hqu/hqapi1/app/ResourceController.groovy
View
@@ -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()
@@ -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)
}
@@ -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) {
Please sign in to comment.
Something went wrong with that request. Please try again.