Skip to content

stack trace on deleting index not in database #57

@codekiln

Description

@codekiln

In 0.8.0, if there is an index only-in-es created in elasticsearch that doesn't exist in the database, it can be listed with ./manage.py es_list --es-only. In theory, ./manage.py es_drop only-in-es --exact should delete it, however, this currently errors out:

$ ./manage.py es_drop test_localdev_movies-1 --exact
[2018-11-18 01:03:48.353449]: While completing drop_index, encountered exception: 
 - message: 'NoneType' object has no attribute 'is_active' 
 - exception doc: Attribute not found. 
 - exception stack: Traceback (most recent call last):
  File "/Users/pnore/hbx/django-elastic-migrations/django_elastic_migrations/models.py", line 312, in start_action
    result = self.perform_action(dem_index, *args, **kwargs)
  File "/Users/pnore/hbx/django-elastic-migrations/django_elastic_migrations/models.py", line 726, in perform_action
    if self.index_version.is_active and not self.force:
AttributeError: 'NoneType' object has no attribute 'is_active'

Looking deeper, it seems as though the dem_index that is received in the drop index action doesn't have access to the full, exact name provided:

> dem_index.get_es_index_name()
None

This is a bug. A test should be written for this scenario and it should be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions