Skip to content

Commit

Permalink
Check that Disk/Ram base units are 1000 or 1024
Browse files Browse the repository at this point in the history
  • Loading branch information
Haeki committed Feb 7, 2025
1 parent 27b7687 commit e21e317
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions netbox/netbox/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@
TIME_ZONE = getattr(configuration, 'TIME_ZONE', 'UTC')
TRANSLATION_ENABLED = getattr(configuration, 'TRANSLATION_ENABLED', True)
DISK_BASE_UNIT = getattr(configuration, 'DISK_BASE_UNIT', 1000)
if DISK_BASE_UNIT not in [1000, 1024]:
raise ImproperlyConfigured(f"DISK_BASE_UNIT must be 1000 or 1024 (found {DISK_BASE_UNIT})")
RAM_BASE_UNIT = getattr(configuration, 'MEMORY_UNIT_DIVISOR', 1000)
if RAM_BASE_UNIT not in [1000, 1024]:
raise ImproperlyConfigured(f"RAM_BASE_UNIT must be 1000 or 1024 (found {RAM_BASE_UNIT})")

# Load any dynamic configuration parameters which have been hard-coded in the configuration file
for param in CONFIG_PARAMS:
Expand Down

0 comments on commit e21e317

Please sign in to comment.