Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catalog deletion failure returns as success #696

Closed
dhruvpatelaj opened this issue Jul 19, 2021 · 4 comments
Closed

Catalog deletion failure returns as success #696

dhruvpatelaj opened this issue Jul 19, 2021 · 4 comments
Assignees

Comments

@dhruvpatelaj
Copy link

dhruvpatelaj commented Jul 19, 2021

Hi there,

The scenario where the bug occurs is when I create a vcd_catalog and upload a local ovf file using vcd_catalog_item. Lets say for whatever reason, kernel dies or you manually (ctrl + c). The file is still uploading. Currently my script calls terraform destroy before any actions to remove any existing code.

So if the file is still uploading, the terraform destroy call will try to delete the catalog. VCD will fail in deleting that catalog as there is a pending template upload, but terraform will return it as deleted. So, now the catalog still exists in VCD, but it no longer exists in terraform .tfstate. Therefore, we would have to manually go and delete the catalog.

The only way to work around this is to let the file upload finish. Should terraform not fail to delete the catalog too?

Terraform Version

Terraform v1.0.2

Affected Resource(s)

Please list the resources as a list, for example:

  • vcd_catalog
  • vcd_catalog_item

Expected Behavior

Terraform should have returned failed to delete catalog

Actual Behavior

Terraform succeeded in deleting catalog, but in actuality, VCD denied the request as there was a pending ovf file uploading within the catalog

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
  2. wait until OVF file starts uploading. Basically until after the catalog is created.
  3. ctrl + c
  4. terraform destroy before OVF file has finished uploading
@dataclouder dataclouder self-assigned this Jul 19, 2021
@dataclouder
Copy link
Contributor

Thanks for this clear report.
I will try to reproduce. The described behavior should not happen.

@dhruvpatelaj
Copy link
Author

Were you able to replicate?

@dataclouder
Copy link
Contributor

Reproduced by using this sequence of events:

  1. add a catalog
  2. add a catalog item
  3. run terraform state rm vcd_catalog_item.$catalog_item_name
  4. run terraform destroy

The destruction operation succeeds, but the catalog (and its item) remain in place.

dataclouder pushed a commit to dataclouder/terraform-provider-vcd that referenced this issue Jul 28, 2021
* Fix Issue vmware#648 adding a storage profile requires the vdc to be replaced
* Fix Issue vmware#696 Catalog deletion failure returns as success

Signed-off-by: Giuseppe Maxia <gmaxia@vmware.com>
@dataclouder
Copy link
Contributor

The behavior is fixed in PR #698.

  • Starting the destroy while the catalog item is still being imported, the catalog deletion now fails because a catalog object is busy with another operation (just like in the web interface);
  • Starting the destroy when the catalog item has been fully imported, and both delete_force and delete_recursive were set, the deletion will succeed

dataclouder added a commit that referenced this issue Aug 6, 2021
* Fix Issue #648 adding a storage profile requires the vdc to be replaced
* Fix Issue #696 Catalog deletion failure returns as success
* Bump up version to 3.4.0
* Update CHANGELOG items

Signed-off-by: Giuseppe Maxia <gmaxia@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants