Skip to content

Commit

Permalink
[raspbian] Added _get_cipher and _update_radio definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ritwick DSouza committed Aug 15, 2017
1 parent 16ddab4 commit d64b5f3
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions netjsonconfig/backends/raspbian/converters/wireless.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,7 @@ def to_intermediate(self):
'maclist': wireless.get('maclist', None),
'encryption': self._get_encryption(wireless)
})
radios = get_copy(self.netjson, 'radios')
if radios:
req_radio = [radio for radio in radios if radio['name'] == wireless.get('radio')][0]
new_interface.update({
'protocol': req_radio.get('protocol').replace(".", ""),
'hwmode': self._get_hwmode(req_radio),
'channel': req_radio.get('channel'),
'channel_width': req_radio.get('channel_width')
})
if 'country' in req_radio:
new_interface.update({'country': req_radio.get('country')})
self._update_radio(wireless, new_interface)
result.append(new_interface)
return (('wireless', result),)

Expand All @@ -50,6 +40,19 @@ def _get_hwmode(self, radio):
else:
return 'a'

def _update_radio(self, wireless, interface):
radios = get_copy(self.netjson, 'radios')
if radios:
req_radio = [radio for radio in radios if radio['name'] == wireless.get('radio')][0]
interface.update({
'protocol': req_radio.get('protocol').replace(".", ""),
'hwmode': self._get_hwmode(req_radio),
'channel': req_radio.get('channel'),
'channel_width': req_radio.get('channel_width')
})
if 'country' in req_radio:
interface.update({'country': req_radio.get('country')})

def _get_encryption(self, wireless):
encryption = wireless.get('encryption', None)
new_encryption = {}
Expand Down

0 comments on commit d64b5f3

Please sign in to comment.