diff options
author | Daniil Baturin <daniil@baturin.org> | 2018-05-24 20:47:09 +0200 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2018-05-24 20:47:09 +0200 |
commit | 8e26cb731b36e8fb0ec48c40be5670c3f77cf346 (patch) | |
tree | 7c6d42c7b6179091d0c285aec572bf75d37cbcf6 | |
parent | 374ebb0e69ecd9eef9c10e23a6f950c188e81e15 (diff) | |
download | vyos-1x-8e26cb731b36e8fb0ec48c40be5670c3f77cf346.tar.gz vyos-1x-8e26cb731b36e8fb0ec48c40be5670c3f77cf346.zip |
T462: make cron jobs run with vyattacfg GID.
-rwxr-xr-x | src/conf_mode/task_scheduler.py | 2 | ||||
-rw-r--r-- | src/tests/test_task_scheduler.py | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/conf_mode/task_scheduler.py b/src/conf_mode/task_scheduler.py index c19b88007..285afe2b5 100755 --- a/src/conf_mode/task_scheduler.py +++ b/src/conf_mode/task_scheduler.py @@ -47,7 +47,7 @@ def split_interval(s): def make_command(executable, arguments): if arguments: - return("{0} {1}".format(executable, arguments)) + return("sg vyattacfg \"{0} {1}\"".format(executable, arguments)) else: return(executable) diff --git a/src/tests/test_task_scheduler.py b/src/tests/test_task_scheduler.py index 7acbbddc5..084bd868c 100644 --- a/src/tests/test_task_scheduler.py +++ b/src/tests/test_task_scheduler.py @@ -88,19 +88,19 @@ class TestUpdateCrontab(unittest.TestCase): 'tasks': [{'name': 'aaa', 'interval': '60m', 'spec': '', 'executable': '/bin/ls', 'args': '-l'}], 'expected': [ '### Generated by vyos-update-crontab.py ###', - '*/60 * * * * root /bin/ls -l'] + '*/60 * * * * root sg vyattacfg \"/bin/ls -l\"'] }, {'name': 'one_task_with_hour', 'tasks': [{'name': 'aaa', 'interval': '10h', 'spec': '', 'executable': '/bin/ls', 'args': '-l'}], 'expected': [ '### Generated by vyos-update-crontab.py ###', - '0 */10 * * * root /bin/ls -l'] + '0 */10 * * * root sg vyattacfg \"/bin/ls -l\"'] }, {'name': 'one_task_with_day', 'tasks': [{'name': 'aaa', 'interval': '10d', 'spec': '', 'executable': '/bin/ls', 'args': '-l'}], 'expected': [ '### Generated by vyos-update-crontab.py ###', - '0 0 */10 * * root /bin/ls -l'] + '0 0 */10 * * root sg vyattacfg \"/bin/ls -l\"'] }, {'name': 'multiple_tasks', 'tasks': [{'name': 'aaa', 'interval': '60m', 'spec': '', 'executable': '/bin/ls', 'args': '-l'}, @@ -108,8 +108,8 @@ class TestUpdateCrontab(unittest.TestCase): ], 'expected': [ '### Generated by vyos-update-crontab.py ###', - '*/60 * * * * root /bin/ls -l', - '0 0 * * * root /bin/ls -ltr'] + '*/60 * * * * root sg vyattacfg \"/bin/ls -l\"', + '0 0 * * * root sg vyattacfg \"/bin/ls -ltr\"'] } ] for t in tests: |