@@ -27,17 +27,7 @@ def to_intermediate(self):
2727 'maclist' : wireless .get ('maclist' , None ),
2828 'encryption' : self ._get_encryption (wireless )
2929 })
30- radios = get_copy (self .netjson , 'radios' )
31- if radios :
32- req_radio = [radio for radio in radios if radio ['name' ] == wireless .get ('radio' )][0 ]
33- new_interface .update ({
34- 'protocol' : req_radio .get ('protocol' ).replace ("." , "" ),
35- 'hwmode' : self ._get_hwmode (req_radio ),
36- 'channel' : req_radio .get ('channel' ),
37- 'channel_width' : req_radio .get ('channel_width' )
38- })
39- if 'country' in req_radio :
40- new_interface .update ({'country' : req_radio .get ('country' )})
30+ self ._update_radio (wireless , new_interface )
4131 result .append (new_interface )
4232 return (('wireless' , result ),)
4333
@@ -50,6 +40,19 @@ def _get_hwmode(self, radio):
5040 else :
5141 return 'a'
5242
43+ def _update_radio (self , wireless , interface ):
44+ radios = get_copy (self .netjson , 'radios' )
45+ if radios :
46+ req_radio = [radio for radio in radios if radio ['name' ] == wireless .get ('radio' )][0 ]
47+ interface .update ({
48+ 'protocol' : req_radio .get ('protocol' ).replace ("." , "" ),
49+ 'hwmode' : self ._get_hwmode (req_radio ),
50+ 'channel' : req_radio .get ('channel' ),
51+ 'channel_width' : req_radio .get ('channel_width' )
52+ })
53+ if 'country' in req_radio :
54+ interface .update ({'country' : req_radio .get ('country' )})
55+
5356 def _get_encryption (self , wireless ):
5457 encryption = wireless .get ('encryption' , None )
5558 new_encryption = {}
0 commit comments