Deleting a device photo does not remove the image from external storage. #3241

Closed
opened 2025-12-29 18:27:02 +01:00 by adam · 2 comments
Owner

Originally created by @dsg-anthony on GitHub (Jan 29, 2020).

Environment

  • Python version: 3.6
  • NetBox version: 2.7.1

Steps to Reproduce

  1. Add photo to device
  2. Remove device or device photo

Expected Behavior

Deleting a device or device photo should remove the image from the external storage

Observed Behavior

Image is deleted from netbox but the photo is left untouched in the external storage. In my case this is a Google Cloud Bucket.

Originally created by @dsg-anthony on GitHub (Jan 29, 2020). ### Environment * Python version: 3.6 * NetBox version: 2.7.1 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox (or the current beta release where applicable). Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a wrapper like pynetbox. --> ### Steps to Reproduce 1. Add photo to device 2. Remove device or device photo <!-- What did you expect to happen? --> ### Expected Behavior Deleting a device or device photo should remove the image from the external storage <!-- What happened instead? --> ### Observed Behavior Image is deleted from netbox but the photo is left untouched in the external storage. In my case this is a Google Cloud Bucket.
adam closed this issue 2025-12-29 18:27:02 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 29, 2020):

Please provide the complete set of steps necessary for someone else to reproduce this issue, including your storage configuration.

This sounds like an issue with the external storage library, django-storages. If that's the case, you'll need to raise an issue against that project as NetBox has no control over how it handles files.

@jeremystretch commented on GitHub (Jan 29, 2020): Please provide the complete set of steps necessary for someone else to reproduce this issue, including your storage configuration. This sounds like an issue with the external storage library, [django-storages](https://django-storages.readthedocs.io/en/stable/). If that's the case, you'll need to raise an issue against that project as NetBox has no control over how it handles files.
Author
Owner

@dsg-anthony commented on GitHub (Jan 29, 2020):

Well I just tested it again and it worked. If it happens again I'll capture some logs and the complete steps.

For documentation sake here is my storage configuration for external storage for google cloud storage.

from google.oauth2 import service_account
STORAGE_BACKEND = 'storages.backends.gcloud.GoogleCloudStorage'
GS_CREDENTIALS=service_account.Credentials.from_service_account_file("/etc/netbox/login-creds.json")
STORAGE_CONFIG = {
    'GS_BUCKET_NAME': 'netbox_prod',
    'GS_PROJECT_ID': 'ID_GOES_HERE',
    'GS_CREDENTIALS': GS_CREDENTIALS,
}
@dsg-anthony commented on GitHub (Jan 29, 2020): Well I just tested it again and it worked. If it happens again I'll capture some logs and the complete steps. For documentation sake here is my storage configuration for external storage for google cloud storage. ``` from google.oauth2 import service_account STORAGE_BACKEND = 'storages.backends.gcloud.GoogleCloudStorage' GS_CREDENTIALS=service_account.Credentials.from_service_account_file("/etc/netbox/login-creds.json") STORAGE_CONFIG = { 'GS_BUCKET_NAME': 'netbox_prod', 'GS_PROJECT_ID': 'ID_GOES_HERE', 'GS_CREDENTIALS': GS_CREDENTIALS, } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3241