Skip to content

Commit

Permalink
handle when null is passed to vlan
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorcary committed Jan 24, 2025
1 parent 55b53fb commit ed831f0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/middlewared/middlewared/plugins/ipmi_/lan.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from functools import cache

from middlewared.schema import accepts, Bool, Dict, Int, IPAddr, List, Password, Ref, returns, Str
from middlewared.service import private, CallError, filterable_returns, CRUDService, ValidationError, ValidationErrors
from middlewared.service import private, CallError, CRUDService, ValidationError, ValidationErrors
from middlewared.utils import filter_list
from middlewared.validators import Netmask, PasswordComplexity, Range

Expand Down Expand Up @@ -38,7 +38,10 @@ def apply_config(channel, data):
rc |= run(base_cmd + ['netmask', data['netmask']], **options).returncode
rc |= run(base_cmd + ['defgw', 'ipaddr', data['gateway']], **options).returncode

rc |= run(base_cmd + ['vlan', 'id', f'{data.get("vlan", "off")}'], **options).returncode
vlan = data.get("vlan")
if vlan is None:
vlan = "off"
rc |= run(base_cmd + ['vlan', 'id', str(vlan)], **options).returncode

rc |= run(base_cmd + ['access', 'on'], **options).returncode
rc |= run(base_cmd + ['auth', 'USER', 'MD2,MD5'], **options).returncode
Expand Down

0 comments on commit ed831f0

Please sign in to comment.