Skip to content

Commit

Permalink
[OpenWrt] Simplified automatic name generation #50
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed May 16, 2016
1 parent 3784643 commit 6be40d9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/source/backends/openwrt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,7 @@ Will be rendered as follows::
package dropbear
config dropbear 'dropbear_dropbear1'
config dropbear 'dropbear_1'
option PasswordAuth 'on'
option Port '22'
option RootPasswordAuth 'on'
Expand Down
2 changes: 1 addition & 1 deletion netjsonconfig/backends/openwrt/templates/default.uci
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package {{ package }}

{% for config in config_blocks %}
config {{ config.config_name }} '{% if config.config_value %}{{ config.config_value }}{% else %}{{ package }}_{{ config.config_name }}{{ loop.index }}{% endif %}'
config {{ config.config_name }} '{% if config.config_value %}{{ config.config_value }}{% else %}{{ config.config_name }}_{{ loop.index }}{% endif %}'
{% for key, value in config.items() %}
{% if value not in ['', None] and not key.startswith('config_') %}
{% if value is not string and value is iterable %}
Expand Down
4 changes: 2 additions & 2 deletions tests/openwrt/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_default(self):
})
expected = self._tabs("""package firewall
config rule 'firewall_rule1'
config rule 'rule_1'
option family 'ipv6'
list icmp_type '130/0'
list icmp_type '131/0'
Expand All @@ -70,7 +70,7 @@ def test_default(self):
option src_ip 'fe80::/10'
option target 'ACCEPT'
config rule 'firewall_rule2'
config rule 'rule_2'
option family 'ipv4'
list icmp_type '130/0'
list icmp_type '131/0'
Expand Down

0 comments on commit 6be40d9

Please sign in to comment.