Skip to content

Commit

Permalink
If vSphere platforms are renamed, check to ensure name is unique.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnguyen committed Jun 28, 2010
1 parent 296d38c commit b7f4a28
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion hqu/hqapi1/app/ResourceController.groovy
Expand Up @@ -651,7 +651,6 @@ class ResourceController extends ApiController {
def anotherPlatformWithSameName = resourceHelper.find('platform':name)

if (anotherPlatformWithSameName) {
// rename platform using this convention: name (fqdn)
def uniqueName = generateVSpherePlatformName(name, fqdn.'@value')
name = uniqueName
config.name = uniqueName
Expand Down Expand Up @@ -682,6 +681,15 @@ class ResourceController extends ApiController {
// 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
}
}
}

Expand Down

0 comments on commit b7f4a28

Please sign in to comment.