VMware Cloud Community
alfnav
Contributor
Contributor

Remove-CIVAppNetwork randomly fails with "The operation cannot be performed because an input object contains stale data"

Hi there,

I'm new to PowerCLI and also to PowerShell, and I think I'm missing something but I can't help to find out what is going on. I'm writing a script that takes a vAPP from a catalog which has a VM inside I can manage to add it a new network to work with but when I try to remove it fails randomly. Find below the piece of code I'm using to add the network (always work like a charm) and the piece of code to remove it (that inexplicably sometimes work and sometimes doesn't)

# Adding the network correctly

$myVapp = Get-CIVApp -orgvdc $orgvdc -name $vapp_New_Name

$myOrgVdcNetwork = Get-OrgVdcNetwork -name $orgVdc_Network_Name -OrgVdc $orgVdc

New-CIVAppNetwork -VApp $myVapp -Direct -ParentOrgVdcNetwork $myOrgVdcNetwork

#Then I try to remove it

$myVapp = Get-CIVApp -orgvdc $orgvdc -name $vapp_New_Name

Get-CIVApp -Name $myVapp | Get-CIVAppNetwork | Remove-CIVAppNetwork -Confirm:$false

Bellow is the error reported randomly:

Get-CIVApp -Name $myVapp | Get-CIVAppNetwork | Remove-CIVAppNetwork -Confirm:$false

Remove-CIVAppNetwork : 6/6/2019 8:15:46 PM Remove-CIVAppNetwork The operation cannot be performed because an input object contains stale data. The object named 'Public_Tenant' contains data which no longer corresponds to the the actual state of the

server. To resolve the issue retrieve a fresh copy of the object from the server and use it to perform the operation.

At line:2 char:48

+ ... me $myVapp | Get-CIVAppNetwork | Remove-CIVAppNetwork -Confirm:$false

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

    + CategoryInfo          : NotSpecified: (:) [Remove-CIVAppNetwork], CIException

    + FullyQualifiedErrorId : CloudImpl_VAppNetworkUpdateHelper_UpdateVAppNetworkUplinkSettings_CIError,VMware.VimAutomation.Cloud.Commands.Cmdlets.VApp.RemoveCiVAppNetwork

Any help would be very appreciated.

Br,

/A

0 Kudos
2 Replies
goce74
Contributor
Contributor

i have the same issue

Remove-CIVAppNetwork : 20/08/2019 12:51:13 PM Remove-CIVAppNetwork The operation cannot be performed because an input

object contains stale data. The object named 'External_DHPW-ProdIntrnlApp-2616' contains data which no longer corresponds

to the the actual state of the server. To resolve the issue retrieve a fresh copy of the object from the server and use it

to perform the operation.

At line:1 char:31

0 Kudos
goce74
Contributor
Contributor

i ran this command

Get-CIVApp -Name 'DEV0-vap01' | Get-CIVAppNetwork | Remove-CIVAppNetwork -Confirm:$false -ErrorAction SilentlyContinue

And it worked.  It removed the Network from the VApp.

Now I just need to install a New network to the Vapp

0 Kudos