Add exception for policy deleted objects

For the NSX policy manager, if an object was deleted, it cannot be
recreated immediately with the same name/path, and should wait until
it is permanently deleted from the backend.
This patch adds the error code and exception for this case.

Change-Id: Icaa41ada29209b476963a8cee4362f211ef02c66
Adit Sarfaty 5 years ago
parent 3483579700
commit a4a11df7e2

@ -35,7 +35,8 @@ def http_error_to_exception(status_code, error_code):
{'202': exceptions.BackendResourceNotFound,
'default': exceptions.ResourceNotFound},
{'60508': exceptions.NsxIndexingInProgress},
{'60508': exceptions.NsxIndexingInProgress,
'500045': exceptions.NsxPendingDelete}, exceptions.StaleRevision, exceptions.StaleRevision,

@ -145,3 +145,9 @@ class NsxSearchInvalidQuery(NsxLibException):
class NsxIndexingInProgress(NsxLibException):
message = _("Bad Request due to indexing is in progress, please retry "
"after sometime")
class NsxPendingDelete(NsxLibException):
message = _("An object with the same name is marked for deletion. Either "
"use another path or wait for the purge cycle to permanently "
"remove the deleted object")