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

Deleting a server that has no environment variables raises sqlalchemy exception #28

Closed
vilhelmprytz opened this issue Feb 1, 2020 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@vilhelmprytz
Copy link
Member

Environment

  • Installation type: snap and pip
  • Python version: 3.7.3
  • Wilfred version: v3.0.0

Steps to Reproduce

  1. Create a server that does not require any environment variables (such as minecraft-bungeecord).
  2. Try to delete it using wilfred delete <name>.

Expected Behavior

Server to be deleted without exceptions.

Observed Behavior

Raises sqlalchemy exception, it tries to delete environment variables which do not exist. Wilfred does not handle this.

See traceback below.

Are you sure you want to do this? All data will be permanently deleted. [y/N]: y
Traceback (most recent call last):
  File "/home/vilhelm/.local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 1999, in delete
    state = attributes.instance_state(instance)
AttributeError: 'NoneType' object has no attribute '_sa_instance_state'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/wilfred", line 10, in <module>
    sys.exit(main())
  File "/home/vilhelm/.local/lib/python3.7/site-packages/wilfred/wilfred.py", line 88, in main
    cli()
  File "/home/vilhelm/.local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/vilhelm/.local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/vilhelm/.local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/vilhelm/.local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/vilhelm/.local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/vilhelm/.local/lib/python3.7/site-packages/wilfred/wilfred.py", line 409, in delete
    servers.remove(server)
  File "/home/vilhelm/.local/lib/python3.7/site-packages/wilfred/servers.py", line 116, in remove
    session.query(EnvironmentVariable).filter_by(server_id=server.id).first()
  File "/home/vilhelm/.local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2001, in delete
    raise exc.UnmappedInstanceError(instance)
sqlalchemy.orm.exc.UnmappedInstanceError: Class 'builtins.NoneType' is not mapped
@vilhelmprytz vilhelmprytz added the bug Something isn't working label Feb 1, 2020
@vilhelmprytz vilhelmprytz self-assigned this Feb 1, 2020
@vilhelmprytz vilhelmprytz modified the milestones: Initial release, v0.4.0 Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant