@@ -11,7 +11,6 @@ Initialization
1111
1212.. automethod :: netjsonconfig.Raspbian.__init__
1313
14-
1514Render method
1615-------------
1716
@@ -55,17 +54,18 @@ Code example:
5554
5655 Will return the following output::
5756
58- config: /etc/network/interfaces
57+ # config: /etc/network/interfaces
58+
5959 auto eth0.1
6060 iface eth0.1 inet static
61- address 192.168.1.1
62- netmask 255.255.255.0
61+ address 192.168.1.1
62+ netmask 255.255.255.0
6363 iface eth0.1 inet static
64- address 192.168.2.1
65- netmask 255.255.255.0
64+ address 192.168.2.1
65+ netmask 255.255.255.0
6666 iface eth0.1 inet6 static
67- address fd87::1
68- netmask 128
67+ address fd87::1
68+ netmask 128
6969
7070Generate method
7171---------------
@@ -80,18 +80,18 @@ Code example:
8080 >> > from netjsonconfig import Raspbian
8181 >> >
8282 >> > o = Raspbian({
83- ... " interfaces" : [
84- ... {
85- ... " name" : " eth0" ,
86- ... " type" : " ethernet" ,
87- ... " addresses" : [
88- ... {
89- ... " proto" : " dhcp" ,
90- ... " family" : " ipv4"
91- ... }
92- ... ]
93- ... }
94- ... ]
83+ ... " interfaces" : [
84+ ... {
85+ ... " name" : " eth0" ,
86+ ... " type" : " ethernet" ,
87+ ... " addresses" : [
88+ ... {
89+ ... " proto" : " dhcp" ,
90+ ... " family" : " ipv4"
91+ ... }
92+ ... ]
93+ ... }
94+ ... ]
9595 ... })
9696 >> > stream = o.generate()
9797 >> > print (stream)
@@ -116,18 +116,18 @@ Example:
116116 >> > from netjsonconfig import Raspbian
117117 >> >
118118 >> > o = Raspbian({
119- ... " interfaces" : [
120- ... {
121- ... " name" : " eth0" ,
122- ... " type" : " ethernet" ,
123- ... " addresses" : [
124- ... {
125- ... " proto" : " dhcp" ,
126- ... " family" : " ipv4"
127- ... }
128- ... ]
129- ... }
130- ... ]
119+ ... " interfaces" : [
120+ ... {
121+ ... " name" : " eth0" ,
122+ ... " type" : " ethernet" ,
123+ ... " addresses" : [
124+ ... {
125+ ... " proto" : " dhcp" ,
126+ ... " family" : " ipv4"
127+ ... }
128+ ... ]
129+ ... }
130+ ... ]
131131 ... })
132132 >> > o.write(' dhcp-router' , path = ' /tmp/' )
133133
@@ -158,10 +158,12 @@ The following *configuration dictionary*:
158158
159159 Will be rendered as follows::
160160
161- config: /etc/hostname
161+ # config: /etc/hostname
162+
162163 routerA
163164
164165 run commands:
166+
165167 $ timedatectl set-timezone UTC
166168
167169After modifying the config files run the following command to change the
@@ -209,11 +211,12 @@ The following *configuration dictionary*:
209211
210212 Will be rendered as follows::
211213
212- config: /etc/network/interfaces
214+ # config: /etc/network/interfaces
215+
213216 auto lo
214217 iface lo inet static
215- address 127.0.0.1
216- netmask 255.0.0.0
218+ address 127.0.0.1
219+ netmask 255.0.0.0
217220
218221Dualstack (IPv4 & IPv6)
219222~~~~~~~~~~~~~~~~~~~~~~~
@@ -247,14 +250,15 @@ The following *configuration dictionary*:
247250
248251 Will be rendered as follows::
249252
250- config: /etc/network/interfaces
253+ # config: /etc/network/interfaces
254+
251255 auto eth0
252256 iface eth0 inet static
253- address 10.27.251.1
254- netmask 255.255.255.0
257+ address 10.27.251.1
258+ netmask 255.255.255.0
255259 iface eth0 inet6 static
256- address fdb4:5f35:e8fd::1
257- netmask 48
260+ address fdb4:5f35:e8fd::1
261+ netmask 48
258262
259263DNS Servers and Search Domains
260264~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -299,7 +303,8 @@ dynamic ip address configuration won't get the ``dns`` option in the UCI output,
299303
300304 Will return the following UCI output::
301305
302- config: /etc/network/interfaces
306+ # config: /etc/network/interfaces
307+
303308 auto eth0
304309 iface eth0 inet static
305310 address 192.168.1.1
@@ -309,6 +314,7 @@ Will return the following UCI output::
309314 iface eth1 inet dhcp
310315
311316 config: /etc/resolv.conf
317+
312318 nameserver 10.11.12.13
313319 nameserver 8.8.8.8
314320 search openwisp.org
@@ -338,7 +344,8 @@ The following *configuration dictionary*:
338344
339345 Will be rendered as follows::
340346
341- config: /etc/network/interfaces
347+ # config: /etc/network/interfaces
348+
342349 auto eth0
343350 iface eth0 inet6 dhcp
344351
@@ -361,7 +368,6 @@ You can install it using this command::
361368
362369 $ aptitude install bridge-utils
363370
364-
365371Bridge Interface Example
366372~~~~~~~~~~~~~~~~~~~~~~~~
367373
@@ -392,7 +398,8 @@ The following *configuration dictionary*:
392398
393399 Will be rendered as follows::
394400
395- config: /etc/network/interfaces
401+ # config: /etc/network/interfaces
402+
396403 auto lan_bridge
397404 iface lan_bridge inet static
398405 address 172.17.0.2
@@ -421,10 +428,10 @@ First we need to setup a static IP for our wireless interface. Edit the
421428
422429 auto wlan0
423430 iface wlan0 inet static
424- address 172.128.1.1
425- netmask 255.255.255.0
426- network 172.128.1.0
427- broadcast 172.128.1.255
431+ address 172.128.1.1
432+ netmask 255.255.255.0
433+ network 172.128.1.0
434+ broadcast 172.128.1.255
428435
429436Reload ``wlan0 `` interface with ``sudo ifdown wlan0; sudo ifup wlan0 ``
430437
@@ -539,7 +546,8 @@ common wireless access point configuration:
539546
540547 Will be rendered as follows::
541548
542- config: /etc/hostapd/hostapd.conf
549+ # config: /etc/hostapd/hostapd.conf
550+
543551 interface=wlan0
544552 driver=nl80211
545553 hw_mode=g
@@ -573,14 +581,15 @@ The following example:
573581
574582 Will result in::
575583
576- config: /etc/network/interfaces
584+ # config: /etc/network/interfaces
585+
577586 auto wireless
578587 iface wireless inet static
579- address 172.128.1.1
580- netmask 255.255.255.0
581- wireless-channel 1
582- wireless-essid freifunk
583- wireless-mode ad-hoc
588+ address 172.128.1.1
589+ netmask 255.255.255.0
590+ wireless-channel 1
591+ wireless-essid freifunk
592+ wireless-mode ad-hoc
584593
585594
586595WPA2 Personal (Pre-Shared Key)
@@ -623,7 +632,8 @@ point using *WPA2 Personal (Pre-Shared Key)* encryption:
623632
624633 Will be rendered as follows::
625634
626- config: /etc/hostapd/hostapd.conf
635+ # config: /etc/hostapd/hostapd.conf
636+
627637 interface=wlan0
628638 driver=nl80211
629639 hw_mode=g
@@ -667,17 +677,16 @@ The following *configuration dictionary* :
667677 " enabled" : True ,
668678 " enable_server" : False ,
669679 " server" : [
670- " 0.openwrt.pool.ntp.org" ,
671- " 1.openwrt.pool.ntp.org" ,
672- " 2.openwrt.pool.ntp.org" ,
673- " 3.openwrt.pool.ntp.org"
680+ " 0.pool.ntp.org" ,
681+ " 1.pool.ntp.org" ,
682+ " 2.pool.ntp.org"
674683 ]
675684 }
676685
677686Will be rendered as follows::
678687
679- config: / etc/ ntp.conf
680- server 0. openwrt.pool.ntp.org
681- server 1. openwrt .pool.ntp.org
682- server 2. openwrt .pool.ntp.org
683- server 3. openwrt .pool.ntp.org
688+ # config: /etc/ntp.conf
689+
690+ server 0 . pool.ntp.org
691+ server 1 . pool.ntp.org
692+ server 2 . pool.ntp.org
0 commit comments