Skip to content

Commit 2c1e72e

Browse files
committed
Fixed 'tx_power' KeyError, introduced in 71b083e #37
1 parent 007da6e commit 2c1e72e

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

netjsonconfig/backends/openwrt/renderers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,9 @@ def _get_radios(self):
224224
for radio in radios:
225225
uci_radio = radio.copy()
226226
# rename tx_power to txpower
227-
uci_radio['txpower'] = radio['tx_power']
228-
del uci_radio['tx_power']
227+
if 'tx_power' in radio:
228+
uci_radio['txpower'] = radio['tx_power']
229+
del uci_radio['tx_power']
229230
# rename driver to type
230231
uci_radio['type'] = radio['driver']
231232
del uci_radio['driver']

tests/openwrt/test_wireless.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def test_radio(self):
2121
"protocol": "802.11n",
2222
"channel": 140,
2323
"channel_width": 20,
24-
"tx_power": 9,
2524
"country": "en"
2625
},
2726
{
@@ -45,7 +44,6 @@ def test_radio(self):
4544
option htmode 'HT20'
4645
option hwmode '11a'
4746
option phy 'phy0'
48-
option txpower '9'
4947
option type 'mac80211'
5048
5149
config wifi-device 'radio1'

0 commit comments

Comments
 (0)