Skip to content

Commit

Permalink
[fix] Fixed parsing wifi interface boolean typecasting
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed May 15, 2022
1 parent 226c983 commit a16a91f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion netjsonconfig/backends/openwrt/converters/wireless.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ def __netjson_wifi_typecast(self, wifi):
'ft_psk_generate_local',
'ieee80211r',
'rsn_preauth',
'isolate',
'doth',
'wmm',
'short_preamble',
'start_disabled',
'default_disabled',
]:
if attr in wifi:
wifi[attr] = wifi[attr] == '1'
Expand Down Expand Up @@ -255,7 +261,7 @@ def __netjson_wifi_typecast(self, wifi):
'wps_pin',
]

def __netjson_encryption(self, wifi): # noqa: max-complexity: 11
def __netjson_encryption(self, wifi): # noqa: C901
if 'encryption' not in wifi:
return
settings = {}
Expand Down
2 changes: 2 additions & 0 deletions tests/openwrt/test_wireless.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class TestWireless(unittest.TestCase, _TabsMixin):
"ack_distance": 300,
"rts_threshold": 1300,
"frag_threshold": 1500,
"isolate": True,
},
}
]
Expand All @@ -53,6 +54,7 @@ class TestWireless(unittest.TestCase, _TabsMixin):
option frag '1500'
option hidden '1'
option ifname 'wlan0'
option isolate '1'
option mode 'ap'
option network 'wlan0'
option rts '1300'
Expand Down

0 comments on commit a16a91f

Please sign in to comment.