openwisp / openwisp-controller

Network and WiFi controller: provisioning, configuration management and updates, (pull via openwisp-config or push via SSH), x509 PKI management and more. Mainly OpenWRT, but designed to work also on other systems.
https://openwisp.io/docs/dev/controller/
Other
550 stars 173 forks source link

[fix] Fixed subnet division rule validation on empty subnet #866 #886

Open praptisharma28 opened 1 month ago

praptisharma28 commented 1 month ago

Fixes #866

-The issue occurs because the code assumes that self.master_subnet and self.master_subnet.subnet are always set, but in this case, they can be None. By adding a check at the beginning of the method, we ensure that a proper validation error is raised when the master subnet is empty or not set. -The validation error will be caught and displayed in the UI instead of causing a 500 internal server error.

coveralls commented 1 month ago

Coverage Status

coverage: 98.225% (+0.001%) from 98.224% when pulling 21ad1b965891c2fc14af414934961eb14e3c6d85 on subnetvalidation into 23025093b7a1ecbf4c0f07ab9d0bd7c2c20bcac4 on master.