Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Re-adding deleted application returns error #573

Closed
rabiihlioui opened this issue Apr 24, 2017 · 9 comments
Closed

Re-adding deleted application returns error #573

rabiihlioui opened this issue Apr 24, 2017 · 9 comments
Assignees

Comments

@rabiihlioui
Copy link

rabiihlioui commented Apr 24, 2017

I want to delete an application it says it doesn't exist anymore and when i want to add it with the same AppID it says that this app exist :

administrator@ubuntu:~$ ttnctl applications delete omniacom3
Are you sure you want to delete application omniacom3?
yes
 FATAL Could not delete application             error=Application with id omniacom3 does not exist
administrator@ubuntu:~$ ttnctl applications add omniacom3 "testapplication"
 FATAL Could not add application                error=An app with the application id omniacom3 already exists
@Sypheos
Copy link
Contributor

Sypheos commented Apr 24, 2017

Application are actually not deleted. When you 'delete' they are hidden and not accessible anymore.
It's confusing and we are working on it.

For the moment I would suggest you stick with the App you have and only remove/add devices inside.

@htdvisser
Copy link
Contributor

@romeovs:

  • Please return OK when deleting an already deleted resource
  • Please allow re-registering an application if the owner is the same

@htdvisser
Copy link
Contributor

@rabiihlioui:

Please follow the issue template when creating issues. That really helps us when we address them.

@htdvisser htdvisser changed the title Add and Delete application error Re-adding deleted application returns error Apr 25, 2017
@romeovs
Copy link
Contributor

romeovs commented May 5, 2017

This is actually a very subtle issue and resolving it should be done with great care.

Going at it I came up with a couple of not-so-trivial questions:

  1. Should all collaborators be able to restore an app? If so what rights should they have? delete presumably. But then we can't remove the app collaborators from the app on deletion. What if someone restores the app without our consent? This might introduce a lot of unexpected behavior for user (who generally would expect deleting an app removes all it's state, mainly the collaborators).
  2. Note that an app does not know a concept of owner it just has a number of collaborators. We could assume it's the first user that created the app, but that's fragile and introduces a lot of support requests (like the gateway already has):

please change the owner of app foo to my colleague

  1. Deleting an app removes it from all future jwt access tokens users create (that's the whole point), but how to authenticate for restoring an app then? You can never obtain authentication for a deleted app. We would need to build a custom authentication step for this, further complicating the account server api.

cc @htdvisser @johanstokking

@johanstokking
Copy link
Contributor

johanstokking commented May 5, 2017

Let's not make it too complicated by introducing an undelete feature. That is asking for trouble as you illustrated. Also constraining only old collaborators with the delete right to undelete the application is not intuitive.

I think there are two options:

  1. There's no such thing as deleting an application. In this case, it's merely archiving an application, and people with archive rights can unarchive if necessary
  2. You really delete an application and everything is gone, and everyone can create an application with the same ID

@htdvisser
Copy link
Contributor

htdvisser commented May 5, 2017

Let's just call it "Archive" instead of delete and be done with it. We can add "Restore" if requested.

@htdvisser htdvisser removed the invalid label Jul 10, 2017
@htdvisser
Copy link
Contributor

htdvisser commented Aug 21, 2017

Today one of our users encountered an issue that requires @johanstokking's proposal number 1: archive/unarchive.

2 is not feasible, as in a decentralized/distributed network we can't guarantee that the deletion of an application is executed everywhere where the application was active.

@ama9910
Copy link

ama9910 commented Aug 21, 2017

The issue I observed is that when deleting an application with ttnctl, the devices remained active. There is now no way to delete those devices using ttnctl, without first selecting the now deleted application - which can't be done.

Proposed option 1 above would allow the application to be unarchived and the devices deleted.

Another alternative might be for ttnctl applications delete also delete the devices as @htdvisser suggested in #private-backend.

@johanstokking
Copy link
Contributor

Yes, these are two separate things. We will take unarchiving into account for the next version of the account server. When an application is deleted, it should be unregistered from the handler, which invokes deleting devices.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants