mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 18:08:42 -05:00
Without this commit, cluster lookup was done by traversing the first level below a given datacenter and comparing the names of the objects present there. Though uncommon, entities at this level may be folders that contain the sought after cluster. To make matters worse, a non cluster entity may have the exact same name as the cluster being looked up. Matching is performed by comparing only entity name and thus a folder entity may be mistakenly returned if it matches the name provided for lookup. Traversal into the folder entity is impossible. There is no error checking or helpful output to determine the issue. This commit changes the method by which cluster lookup is performed. It assumes that, as before, the cluster name will be provided as a string and it will be looked up by that string. However the string can be a relative entity path as well used to traverse a folder entity. The new lookup uses the #traverse() method from the datacenter entity to find the cluster entity. There is also some simple return type checking to tell if what we found in the traversal is a `RbVmomi::VIM::ClusterComputeResource` object. If not, a basic indication of the problem is raised to the user. |
||
|---|---|---|
| .. | ||
| vmpooler | ||
| vmpooler.rb | ||