Skip to content

Commit

Permalink
[openvpn] Allow to omit seconds in status attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Feb 8, 2017
1 parent 42204cc commit c4aa07a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion netjsonconfig/backends/openvpn/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
"description": "Write operational status to file every n seconds; "
"eg: \"/var/run/openvpn.status 10\"",
"type": "string",
"pattern": "^((\\S*) ([0-9]*)|)$",
"pattern": "^((\\S*) ([0-9]*)|(\\S*)|)$",
"propertyOrder": 35,
},
"status_version": {
Expand Down
7 changes: 7 additions & 0 deletions tests/openvpn/test_backend.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import copy
import tarfile
import unittest

Expand Down Expand Up @@ -220,6 +221,12 @@ def test_no_status_file(self):
self.assertNotIn('status', output)
self.assertNotIn('status-version', output)

def test_status_file_no_seconds(self):
conf = copy.deepcopy(self._simple_conf)
conf['openvpn'][0]['status'] = '/var/run/openvpn.status'
c = OpenVpn(conf)
self.assertIn('status /var/run/openvpn.status', c.render())

def test_server_bridge(self):
c = OpenVpn({
"openvpn": [{
Expand Down

0 comments on commit c4aa07a

Please sign in to comment.