Skip to content

Commit 712e4e6

Browse files
pandafynemesifier
authored andcommitted
[fix] Update ZeroTier default name from 'ow_zt' to 'global'
The configuration format has changed on OpenWrt since ZeroTier 1.14.0. Previously, it supported running multiple services of the ZeroTier controller, but now only one service is allowed called "global". Hence, the default name is changed from "ow_zt" to "global".
1 parent ad5f75f commit 712e4e6

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

docs/source/backends/zerotier.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ Required properties:
300300
==================== ======= ========================== =========================
301301
key name type default description
302302
==================== ======= ========================== =========================
303-
``name`` string ``ow_zt`` name of the zerotier
303+
``name`` string ``global`` name of the zerotier
304304
network
305305
``networks`` list ``[{}]`` list of dictionaries
306306
containing strings with
@@ -363,7 +363,7 @@ Example (with custom zerotier interface name):
363363
from netjsonconfig import OpenWrt
364364
365365
client_config = OpenWrt.zerotier_auto_client(
366-
name="ow_zt",
366+
name="global",
367367
networks=[{"id": "9536600adf654321", "ifname": "owzt654321"}],
368368
)
369369
print(OpenWrt(client_config).render())
@@ -374,13 +374,16 @@ Will be rendered as:
374374
375375
package zerotier
376376
377-
config zerotier 'ow_zt'
377+
config zerotier 'global'
378378
option config_path '/etc/openwisp/zerotier'
379379
option copy_config_path '1'
380380
option enabled '1'
381381
list join '9536600adf654321'
382382
option secret '{{secret}}'
383383
384+
config network 'owzt654321'
385+
option id '9536600adf654321'
386+
384387
# ---------- files ---------- #
385388
386389
# path: /etc/openwisp/zerotier/devicemap
@@ -446,7 +449,7 @@ Now add ``local_conf_path`` option to ``/etc/config/zerotier``:
446449
447450
package zerotier
448451
449-
config zerotier 'ow_zt'
452+
config zerotier 'global'
450453
option enabled '1'
451454
list join '9536600adf654322'
452455
option secret '{{secret}}'

netjsonconfig/backends/zerotier/zerotier.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ZeroTier(BaseVpnBackend):
1717
@classmethod
1818
def auto_client(
1919
cls,
20-
name='ow_zt',
20+
name='global',
2121
networks=None,
2222
identity_secret='{{secret}}',
2323
config_path='/etc/openwisp/zerotier',

tests/openwrt/test_backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ def test_zerotier_auto_client(self):
548548
expected = {
549549
'zerotier': [
550550
{
551-
'name': 'ow_zt',
551+
'name': 'global',
552552
'networks': [],
553553
'secret': '{{secret}}',
554554
'config_path': '/etc/openwisp/zerotier',
@@ -561,7 +561,7 @@ def test_zerotier_auto_client(self):
561561
expected = {
562562
'zerotier': [
563563
{
564-
'name': 'ow_zt',
564+
'name': 'global',
565565
'networks': [
566566
{'id': '9536600adf654321', 'ifname': 'owzt654321'}
567567
],

tests/openwrt/test_zerotier.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class TestZeroTier(unittest.TestCase, _TabsMixin):
1212
"zerotier": [
1313
{
1414
"local_conf_path": "/etc/openwisp/zerotier/zerotier.conf",
15-
"name": "ow_zt",
15+
"name": "global",
1616
"networks": [
1717
{
1818
"id": "9536600adf654321",
@@ -36,7 +36,7 @@ class TestZeroTier(unittest.TestCase, _TabsMixin):
3636
}
3737
_multiple_networks_uci = """package zerotier
3838
39-
config zerotier 'ow_zt'
39+
config zerotier 'global'
4040
option config_path '/etc/openwisp/zerotier'
4141
option copy_config_path '1'
4242
option enabled '1'
@@ -77,11 +77,11 @@ class TestZeroTier(unittest.TestCase, _TabsMixin):
7777
_TEST_DIFF_NAME_MULTIPLE_CONFIG = {
7878
"zerotier": [
7979
{
80-
"name": "ow_zt1",
80+
"name": "global1",
8181
"networks": [{"id": "9536600adf654321", "ifname": "owzt654321"}],
8282
},
8383
{
84-
"name": "ow_zt2",
84+
"name": "global2",
8585
"networks": [{"id": "9536600adf654322", "ifname": "owzt654322"}],
8686
},
8787
]
@@ -96,7 +96,7 @@ def test_zt_parse_old(self):
9696
native = self._tabs(
9797
"""package zerotier
9898
99-
config zerotier 'ow_zt'
99+
config zerotier 'global'
100100
option enabled '0'
101101
option local_conf '/etc/openwisp/zerotier/zerotier.conf'
102102
list join '9536600adf654321'
@@ -111,7 +111,7 @@ def test_zt_parse_old(self):
111111
{"id": "9536600adf654321", "ifname": "owzt654321"},
112112
{"id": "9536600adf654322", "ifname": "owzt654322"},
113113
],
114-
"name": "ow_zt",
114+
"name": "global",
115115
"disabled": True,
116116
},
117117
]
@@ -123,7 +123,7 @@ def test_zt_parse_new(self):
123123
native = self._tabs(
124124
"""package zerotier
125125
126-
config zerotier 'ow_zt'
126+
config zerotier 'global'
127127
option enabled '0'
128128
option local_conf_path '/etc/openwisp/zerotier/zerotier.conf'
129129
@@ -153,7 +153,7 @@ def test_zt_parse_new(self):
153153
"allow_dns": False,
154154
},
155155
],
156-
"name": "ow_zt",
156+
"name": "global",
157157
"disabled": True,
158158
},
159159
]

tests/zerotier/test_backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,15 +393,15 @@ def test_auto_client(self):
393393
test_config = self._TEST_CONFIG["zerotier"][0]
394394
nw_id = test_config['id']
395395
expected = {
396-
'name': 'ow_zt',
396+
'name': 'global',
397397
'networks': [{'id': '9536600adf654321', 'ifname': 'owzt654321'}],
398398
'secret': 'test_secret',
399399
'config_path': '/etc/openwisp/zerotier',
400400
'disabled': False,
401401
}
402402
self.assertEqual(
403403
ZeroTier.auto_client(
404-
name="ow_zt",
404+
name="global",
405405
networks=[
406406
{
407407
'id': nw_id,

0 commit comments

Comments
 (0)