Quantcast
Channel: VMware Communities : Popular Discussions - vCloud Director PowerCLI
Viewing all articles
Browse latest Browse all 13334

vCloud not returning expected data?

$
0
0

Ran into something goofy/unexpected on vCloud Director 5.5.2 with PowerCLI 5.8.0.

The logic (in this particular scenario anyway), just checks if the vApp exists; if it doesn't it returns null, then it creates the vApp then does another request for the object. If the vApp does exist, it just skips the creation and moves on to use the object somewhere else.

When I run a command to get an object (typically a vApp Template), it'll return null, even though the object exists. The same thing happens when we request a vDC. Is this something broken with our vCloud Director install?

 

So for example, the following code...

 

#check if the vApp exists, if not, create it

$vApp=Get-CIVApp-Name$vAppName-OrgVdc$vDC  -ErrorAction:SilentlyContinue

  if($vApp-eq$null){

      #create the new vApp

      New-CIVApp-Name$vAppName-OrgVdc$vDC-VAppTemplate$vAppTemplate# -ErrorAction:Stop

      #get the newly created vApp and store it. If it doesn't exist, fail the script

      $vApp=Get-CIVApp-Name$vAppName-OrgVdc$vDC  -ErrorAction:Stop

  }


...results in the following errors:

 

New-CIVApp : 1/9/2015 7:09:59 PM    New-CIVApp        DUPLICATE_NAME: The VCD entity new_vApp already exists.   

At C:\Users\me\Desktop\Programming_SP15.ps1:149 char:4

+             New-CIVApp -Name $vAppName -OrgVdc $vDC -VAppTemplate $vAppTemplate # -ErrorA ...

+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [New-CIVApp], CIServerException

    + FullyQualifiedErrorId : VMware.VimAutomation.Cloud.Impl.VAppServiceImpl.NewVAppFromTemplate.Error,VMware.VimAutomation.Cloud.Commands.Cmdlets.NewCIVApp

 

Get-CIVApp : 1/9/2015 7:09:59 PM    Get-CIVApp        CIVApp with name 'new_vApp' was not found using the specified filter(s).   

At C:\Users\me\Desktop\Programming_SP15.ps1:152 char:10

+             $vApp=Get-CIVApp -Name $vAppName -OrgVdc $vDC  -ErrorAction:Stop

+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (:) [Get-CIVApp], VimException

    + FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.Cloud.Commands.Cmdlets.GetCIVApp


Viewing all articles
Browse latest Browse all 13334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>