From 133bb38368950ffae26bca83f3079caed1f07c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Jeanneret?= Date: Mon, 8 Oct 2018 13:10:14 +0200 Subject: [PATCH] Set standard mode for systemd generated unit files There isn't any secret in the container unit file, so we can use the systemd standard mode (0644). Change-Id: If1006ea9b6db89c4a64d632c1bd5bf2538beb2f1 --- paunch/tests/test_utils_systemd.py | 2 +- paunch/utils/systemd.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/paunch/tests/test_utils_systemd.py b/paunch/tests/test_utils_systemd.py index 156ab38..70228a8 100644 --- a/paunch/tests/test_utils_systemd.py +++ b/paunch/tests/test_utils_systemd.py @@ -37,7 +37,7 @@ class TestUtilsSystemd(base.TestCase): self.assertIn('Wants=something.service', unit) self.assertIn('Restart=always', unit) self.assertIn('ExecStop=/usr/bin/podman stop -t 15 my_app', unit) - mock_chmod.assert_has_calls([mock.call(sysd_unit_f, 448)]) + mock_chmod.assert_has_calls([mock.call(sysd_unit_f, 420)]) mock_subprocess_call.assert_has_calls([ mock.call(['systemctl', 'enable', '--now', container]), diff --git a/paunch/utils/systemd.py b/paunch/utils/systemd.py index 6244e8a..b7ed186 100644 --- a/paunch/utils/systemd.py +++ b/paunch/utils/systemd.py @@ -54,7 +54,7 @@ def service_create(container, cconfig, sysdir='/etc/systemd/system/'): 'stop_grace_period': stop_grace_period, } with open(sysd_unit_f, 'w') as unit_file: - os.chmod(unit_file.name, 0o700) + os.chmod(unit_file.name, 0o644) unit_file.write("""[Unit] Description=%(name)s container After=paunch-container-shutdown.service