Solved

PrismCentral 2020.9.0.1 cant delete Project

  • 9 December 2020
  • 1 reply
  • 72 views

Userlevel 1
Badge +2

Hi!

 have a Project in Prism Central that's acting wierd.

When i try to update the Project trough GUI i get this error message:

Edit conflict: please retry change.
Notification { "api_version": "3.1", "code": 409, "kind": "project_internal", "message_list": [ { "message": "Edit conflict: please retry change.", "reason": "CONCURRENT_REQUESTS_NOT_ALLOWED" } ], "state": "ERROR" }

So i connect with SSH to a PC CVM, and try to delete the project trough nuclei,

<nuclei> project.delete Project \Name confirm=true
Confirm deletion of project? (yes/no) yes

{ "message":
{ "kind": "project",
"code": 409,

"message_list":
[ { "message": "Edit conflict: please retry change.", "reason": "CONCURRENT_REQUESTS_NOT_ALLOWED" } ],

"state": "ERROR", "api_version": "3.1" } }

It is only the specific project that has this problem, other projects works just fine. I have searched KBs but cant find anything. The ncc health_checks run_all are not showing up anything suspicious. 

 

I have also opened a case on this error!

icon

Best answer by jonas.hogman 9 December 2020, 15:36

Ok!
So i just got this solved by support. 

There was a category for this project witch was stale. 
So support used a script called remove_stale_entries.py. 

CAUTION!
Use this only after verifying with support that it’s safe. But for CE users, it might help :)

import env
import argparse
from insights_interface.insights_interface_pb2 import *
from insights_interface.insights_interface import *
interface = InsightsInterface('127.0.0.1', 2027)

parser = argparse.ArgumentParser()
parser.add_argument("--uuid", nargs="*", required=True, help="Enter stale entity's UUID as a list separated by space", default=[])
parser.add_argument("--entity_type", required=True, help="Enter the type of entity. Example : task,vm etc. ")
parser.add_argument("--cas", help="Use this flag for deleting CAS entities, else deletion will fail", action="store_true", required=False)

if len(sys.argv)==1:
parser.print_help()
sys.exit(1)

args = parser.parse_args()
entity_list = args.uuid
entity_type = args.entity_type
cas = args.cas
g = GetEntitiesArg()
for entity_id in entity_list:
e = EntityGuid()
e.entity_type_name = entity_type
e.entity_id = entity_id
g.entity_guid_list.extend([e])

res = interface.GetEntities(g)

if len(res.entity) == 0:
print "No entities found matching the input UUID(s)."

for entity in res.entity:
d = DeleteEntityArg()
d.entity_guid.CopyFrom(entity.entity_guid)
if(cas):
d.cas_value = entity.cas_value + 1
print 'deleting entity %s with CAS %s' \
% (str(entity.entity_guid.entity_id), entity.cas_value)
else:
print 'deleting entity %s' % (str(entity.entity_guid.entity_id))
interface.DeleteEntity(d)

put the script i /home/nutanix/bin

chmod 777 on the script. 

Then used nuclei project.list to get the UUID from the undeletable project. 

Then ran the python script:

python remove_stale_entries.py --uuid 857fbbf0-3ecc-5d9e-b4b4-f9b4b54d8192 --entity_type=abac_category --cas
tada, the project is gone :)

View original

1 reply

Userlevel 1
Badge +2

Ok!
So i just got this solved by support. 

There was a category for this project witch was stale. 
So support used a script called remove_stale_entries.py. 

CAUTION!
Use this only after verifying with support that it’s safe. But for CE users, it might help :)

import env
import argparse
from insights_interface.insights_interface_pb2 import *
from insights_interface.insights_interface import *
interface = InsightsInterface('127.0.0.1', 2027)

parser = argparse.ArgumentParser()
parser.add_argument("--uuid", nargs="*", required=True, help="Enter stale entity's UUID as a list separated by space", default=[])
parser.add_argument("--entity_type", required=True, help="Enter the type of entity. Example : task,vm etc. ")
parser.add_argument("--cas", help="Use this flag for deleting CAS entities, else deletion will fail", action="store_true", required=False)

if len(sys.argv)==1:
parser.print_help()
sys.exit(1)

args = parser.parse_args()
entity_list = args.uuid
entity_type = args.entity_type
cas = args.cas
g = GetEntitiesArg()
for entity_id in entity_list:
e = EntityGuid()
e.entity_type_name = entity_type
e.entity_id = entity_id
g.entity_guid_list.extend([e])

res = interface.GetEntities(g)

if len(res.entity) == 0:
print "No entities found matching the input UUID(s)."

for entity in res.entity:
d = DeleteEntityArg()
d.entity_guid.CopyFrom(entity.entity_guid)
if(cas):
d.cas_value = entity.cas_value + 1
print 'deleting entity %s with CAS %s' \
% (str(entity.entity_guid.entity_id), entity.cas_value)
else:
print 'deleting entity %s' % (str(entity.entity_guid.entity_id))
interface.DeleteEntity(d)

put the script i /home/nutanix/bin

chmod 777 on the script. 

Then used nuclei project.list to get the UUID from the undeletable project. 

Then ran the python script:

python remove_stale_entries.py --uuid 857fbbf0-3ecc-5d9e-b4b4-f9b4b54d8192 --entity_type=abac_category --cas
tada, the project is gone :)

Reply