Skip to content

Commit 0f84f1d

Browse files
committed
[airos] add default values to every instance of get_copy
1 parent 1a8c944 commit 0f84f1d

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

netjsonconfig/backends/airos/converters.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def wpa2_personal(self):
3333
When using wpa_personal the wifi password is written
3434
in ``aaa.1.wpa.psk`` instead of ``wpasupplicant``
3535
"""
36-
wireless = [ i for i in get_copy(self.netjson, 'interfaces') if i['type'] == 'wireless']
36+
wireless = [i for i in get_copy(self.netjson, 'interfaces', []) if i['type'] == 'wireless']
3737

3838
def get_psk(interface):
3939
t = {
@@ -93,7 +93,7 @@ def to_intermediate(self):
9393
result = []
9494

9595
original = [
96-
i for i in get_copy(self.netjson, self.netjson_key) if i['type'] == 'bridge'
96+
i for i in get_copy(self.netjson, self.netjson_key, []) if i['type'] == 'bridge'
9797
]
9898

9999
bridges = []
@@ -256,12 +256,12 @@ def type_to_role(self, typestr):
256256
'ethernet': 'mlan',
257257
'bridge': 'mlan',
258258
}
259-
return roles.get(typestr,'')
259+
return roles.get(typestr, '')
260260

261261
def to_intermediate(self):
262262
result = []
263263
interfaces = []
264-
original = get_copy(self.netjson, self.netjson_key)
264+
original = get_copy(self.netjson, self.netjson_key, [])
265265

266266
for interface in original:
267267
base = {
@@ -384,7 +384,7 @@ class Radio(BaseConverter):
384384
def to_intermediate(self):
385385
result = []
386386

387-
original = get_copy(self.netjson, self.netjson_key)
387+
original = get_copy(self.netjson, self.netjson_key, [])
388388

389389
radios = []
390390

@@ -418,7 +418,7 @@ def host(self):
418418
}
419419

420420
def nameserver(self):
421-
original = get_copy(self.netjson, self.netjson_key)
421+
original = get_copy(self.netjson, self.netjson_key, [])
422422

423423
t = []
424424

@@ -449,7 +449,7 @@ class Route(AirOSConverter):
449449

450450
def to_intermediate(self):
451451
result = []
452-
original = get_copy(self.netjson, self.netjson_key)
452+
original = get_copy(self.netjson, self.netjson_key, [])
453453

454454
routes = []
455455

@@ -610,7 +610,7 @@ class Vlan(AirOSConverter):
610610
def to_intermediate(self):
611611
result = []
612612
original = [
613-
i for i in get_copy(self.netjson, self.netjson_key) if '.' in i['name']
613+
i for i in get_copy(self.netjson, self.netjson_key, []) if '.' in i['name']
614614
]
615615

616616
vlans = []
@@ -636,7 +636,7 @@ class Wireless(AirOSConverter):
636636
def to_intermediate(self):
637637
result = []
638638
original = [
639-
i for i in get_copy(self.netjson, self.netjson_key) if i['type'] == 'wireless'
639+
i for i in get_copy(self.netjson, self.netjson_key, []) if i['type'] == 'wireless'
640640
]
641641

642642
ws = []
@@ -790,7 +790,7 @@ def secondary_network(self):
790790

791791
def to_intermediate(self):
792792
original = [
793-
i for i in get_copy(self.netjson, self.netjson_key) if i['type'] == 'wireless'
793+
i for i in get_copy(self.netjson, self.netjson_key, []) if i['type'] == 'wireless'
794794
]
795795

796796
if original:

0 commit comments

Comments
 (0)