Skip to content

Commit 2ac0773

Browse files
author
Ritwick DSouza
committed
[raspbian] Added adhoc support
1 parent 623ede2 commit 2ac0773

1 file changed

Lines changed: 22 additions & 17 deletions

File tree

netjsonconfig/backends/raspbian/converters.py

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,33 @@ def to_intermediate(self):
1313
new_interface = {}
1414
ifname = interface.get('name')
1515
iftype = interface.get('type')
16-
16+
new_interface.update({
17+
'ifname': ifname,
18+
'iftype': iftype
19+
})
1720
if iftype in ['ethernet', 'bridge', 'loopback']:
18-
new_interface.update({
19-
'ifname': ifname,
20-
'iftype': iftype
21-
})
2221
addresses = self._get_address(interface)
2322
new_interface.update({
2423
'address': addresses
2524
})
26-
mac = interface.get('mac', False)
27-
if mac:
28-
new_interface.update({'mac': mac})
29-
mtu = interface.get('mtu', False)
30-
if mtu:
31-
new_interface.update({'mtu': mtu})
32-
txqueuelen = interface.get('txqueuelen', False)
33-
if txqueuelen:
34-
new_interface.update({'txqueuelen': txqueuelen})
35-
autostart = interface.get('autostart', False)
36-
if autostart:
37-
new_interface.update({'autostart': autostart})
25+
mac = interface.get('mac', False)
26+
if mac:
27+
new_interface.update({'mac': mac})
28+
mtu = interface.get('mtu', False)
29+
if mtu:
30+
new_interface.update({'mtu': mtu})
31+
txqueuelen = interface.get('txqueuelen', False)
32+
if txqueuelen:
33+
new_interface.update({'txqueuelen': txqueuelen})
34+
autostart = interface.get('autostart', False)
35+
if autostart:
36+
new_interface.update({'autostart': autostart})
37+
if iftype == 'wireless' and interface.get('wireless').get('mode') == 'adhoc':
38+
wireless = interface.get('wireless')
39+
new_interface.update({
40+
'essid': wireless.get('ssid'),
41+
'mode': wireless.get('mode')
42+
})
3843
if iftype == 'bridge':
3944
new_interface.update({
4045
'bridge_members': interface.get('bridge_members')

0 commit comments

Comments
 (0)