Unable to delete resource handler due to 'unhashable type: NSXScope' error

Problem 

Sometimes when trying to delete a resource handler you will run into the error

unhashable type : NSXScope

This article is going to go over how to get around this and be able to delete the resource handler from CMP.

Cause

When trying to delete a resource handler that was previously attached to an NSX instance this can happen.

Workaround or Solution

Overview

We have to assign the NSXEdge and NSXScope objects in the database a hash function, because one does not exist for them normally.


Open shell_plus

  1. SSH into your CloudBolt CMP instance

  2. Run this command: /opt/cloudbolt/manage.py shell_plus to open an interactive python shell

Add a hash function to the two NSX objects

  1. Enter these commands:

NSXEdge.__hash__ = super.__hash__
NSXScope.__hash__ = super.__hash__

Try to delete the resource handler

  1. You can do this one of two ways.

    1. In shell_plus, grab the ResourceHandler object like this: rh = ResourceHandler.objects.get(id=<rh_id>)

      1. Make sure you replace <rh_id> with the id of the resource handler you want to delete, this can be found in the URL while on the resource handlers details page.

    2. Then run this command: rh.delete() to delete the resource handler

    3. You can also just navigate back to the CloudBolt UI and use the “Delete” button on the Resource Handlers details page as well.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.