Skip to content

Commit c4aa07a

Browse files
committed
[openvpn] Allow to omit seconds in status attribute
1 parent 42204cc commit c4aa07a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

netjsonconfig/backends/openvpn/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
"description": "Write operational status to file every n seconds; "
293293
"eg: \"/var/run/openvpn.status 10\"",
294294
"type": "string",
295-
"pattern": "^((\\S*) ([0-9]*)|)$",
295+
"pattern": "^((\\S*) ([0-9]*)|(\\S*)|)$",
296296
"propertyOrder": 35,
297297
},
298298
"status_version": {

tests/openvpn/test_backend.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import copy
12
import tarfile
23
import unittest
34

@@ -220,6 +221,12 @@ def test_no_status_file(self):
220221
self.assertNotIn('status', output)
221222
self.assertNotIn('status-version', output)
222223

224+
def test_status_file_no_seconds(self):
225+
conf = copy.deepcopy(self._simple_conf)
226+
conf['openvpn'][0]['status'] = '/var/run/openvpn.status'
227+
c = OpenVpn(conf)
228+
self.assertIn('status /var/run/openvpn.status', c.render())
229+
223230
def test_server_bridge(self):
224231
c = OpenVpn({
225232
"openvpn": [{

0 commit comments

Comments
 (0)