-
Notifications
You must be signed in to change notification settings - Fork 171
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
[feature] Implemented device deactivation and reactivation #625 #840
base: master
Are you sure you want to change the base?
Conversation
Removing VPN template from a device will dekete rekated Cert object. Instead, it will mark the certificate as revoked. Closes #827
ae5a5ca
to
2c16d95
Compare
2c16d95
to
5f9523f
Compare
@@ -368,7 +368,6 @@ def update_config(self): | |||
except Exception as e: | |||
logger.exception(e) | |||
else: | |||
self.device.config.set_status_applied() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nemesifier why do we need this? It is creating an issue for marking the device as deactivated. Instead of changing the status from deactivating to deactivated, this code is changing the status to applied. Can we rely on the report status request from the agent for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, proceed, there may be some test to change because of this removal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4382340
to
b427efd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
I did a quick code review, find my comments below.
Please let's take advantage to introduce the improvement discussed yesterday:
diff --git a/openwisp_controller/config/admin.py b/openwisp_controller/config/admin.py
index 764ae7f..cd573fb 100644
--- a/openwisp_controller/config/admin.py
+++ b/openwisp_controller/config/admin.py
@@ -641,6 +641,10 @@ class DeviceAdmin(MultitenantAdminMixin, BaseConfigAdmin, UUIDAdmin):
ip.short_description = _('IP address')
def config_status(self, obj):
+ if obj.is_deactivated:
+ return _('deactivated')
+ if not obj.config:
+ return _('unknown')
return obj.config.status
config_status.short_description = _('config status')
Another note:
Can we hide the save and save continue button on deactivated devices?
What else is missing?
- Do not allow to delete devices which are not deactivated first via admin action
- Admin inlines
- It would be great to show the readonly config value as indented JSON (now it shows
OrderedDict(...)
).
API changes:
- Disable API endpoints to make changes to deactivated devices
- I think we need to allow to enable and disable a device via API too, right?
We could split the API changes in a separate issue but we need to discuss this first
Anything else?
Closes #625
Blockers
TODOS