-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] Fixed UCI format backward compatibility with OpenWISP 1
This fix is needed to allow workarounds in the code of OpenWISP-Firmware to keep working also with OpenWISP 2.
- Loading branch information
1 parent
cbb03fd
commit a0cda13
Showing
4 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from ..openwrt.renderer import OpenWrtRenderer as BaseRenderer | ||
|
||
|
||
class OpenWrtRenderer(BaseRenderer): | ||
""" | ||
OpenWRT Renderer for OpenWISP 1.x backend | ||
It uses a slightly different template | ||
than the default OpenWRT renderer in order | ||
to provide backward compatibility with the | ||
format that was generated by OpenWISP Manager. | ||
E.g.: | ||
# OpenWISP Manager: | ||
config 'system' 'system' | ||
option 'hostname' 'openwisp-test' | ||
# standard OpenWRT conf generated by netjsonconfig: | ||
config system 'system' | ||
option hostname 'openwisp-test' | ||
""" | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% for package, config_blocks in data.items() %} | ||
package {{ package }} | ||
|
||
{% for config in config_blocks %} | ||
config '{{ config['.type'] }}' '{{ config['.name'] }}' | ||
{% for key, value in config.items() %} | ||
{% if value not in ['', None] and not key.startswith('.') %} | ||
{% if value is not string and value is iterable %} | ||
{% for list_value in value %} | ||
list '{{ key }}' '{{ list_value }}' | ||
{% endfor %} | ||
{% else %} | ||
option '{{ key }}' '{{ value }}' | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
|
||
{% endfor %} | ||
|
||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters