From 7e109a300018bd8c94a8b1b4c7fd66512d6e4643 Mon Sep 17 00:00:00 2001 From: Kevin Nasto Date: Tue, 15 Aug 2023 12:43:20 -0500 Subject: [PATCH] Added quiet parameter to systemd so start and stop would be muted --- landscape/client/serviceconfig.py | 2 +- landscape/client/tests/test_serviceconfig.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/landscape/client/serviceconfig.py b/landscape/client/serviceconfig.py index 7715fec26..e4ec7569f 100644 --- a/landscape/client/serviceconfig.py +++ b/landscape/client/serviceconfig.py @@ -65,7 +65,7 @@ def _call_systemctl( stdout. """ return subprocess.run( - [SYSTEMCTL, action, SYSTEMD_SERVICE], + [SYSTEMCTL, action, SYSTEMD_SERVICE, "--quiet"], stdout=subprocess.PIPE, **run_kwargs, ) diff --git a/landscape/client/tests/test_serviceconfig.py b/landscape/client/tests/test_serviceconfig.py index 89154aea4..0bb76451d 100644 --- a/landscape/client/tests/test_serviceconfig.py +++ b/landscape/client/tests/test_serviceconfig.py @@ -23,14 +23,14 @@ def setUp(self): def test_set_to_run_on_boot(self): SystemdConfig.set_start_on_boot(True) self.run_mock.assert_called_once_with( - [SYSTEMCTL, "enable", "landscape-client.service"], + [SYSTEMCTL, "enable", "landscape-client.service", "--quiet"], stdout=subprocess.PIPE, ) def test_set_to_not_run_on_boot(self): SystemdConfig.set_start_on_boot(False) self.run_mock.assert_called_once_with( - [SYSTEMCTL, "disable", "landscape-client.service"], + [SYSTEMCTL, "disable", "landscape-client.service", "--quiet"], stdout=subprocess.PIPE, ) @@ -39,7 +39,7 @@ def test_configured_to_run(self): self.assertTrue(SystemdConfig.is_configured_to_run()) self.run_mock.assert_called_once_with( - [SYSTEMCTL, "is-enabled", "landscape-client.service"], + [SYSTEMCTL, "is-enabled", "landscape-client.service", "--quiet"], stdout=subprocess.PIPE, ) @@ -48,14 +48,14 @@ def test_not_configured_to_run(self): self.assertFalse(SystemdConfig.is_configured_to_run()) self.run_mock.assert_called_once_with( - [SYSTEMCTL, "is-enabled", "landscape-client.service"], + [SYSTEMCTL, "is-enabled", "landscape-client.service", "--quiet"], stdout=subprocess.PIPE, ) def test_run_landscape(self): SystemdConfig.restart_landscape() self.run_mock.assert_called_once_with( - [SYSTEMCTL, "restart", "landscape-client.service"], + [SYSTEMCTL, "restart", "landscape-client.service", "--quiet"], check=True, stdout=subprocess.PIPE, ) @@ -68,7 +68,7 @@ def test_run_landscape_exception(self): SystemdConfig.restart_landscape, ) self.run_mock.assert_called_once_with( - [SYSTEMCTL, "restart", "landscape-client.service"], + [SYSTEMCTL, "restart", "landscape-client.service", "--quiet"], check=True, stdout=subprocess.PIPE, ) @@ -76,7 +76,7 @@ def test_run_landscape_exception(self): def test_stop_landscape(self): SystemdConfig.stop_landscape() self.run_mock.assert_called_once_with( - [SYSTEMCTL, "stop", "landscape-client.service"], + [SYSTEMCTL, "stop", "landscape-client.service", "--quiet"], check=True, stdout=subprocess.PIPE, ) @@ -89,7 +89,7 @@ def test_stop_landscape_exception(self): SystemdConfig.stop_landscape, ) self.run_mock.assert_called_once_with( - [SYSTEMCTL, "stop", "landscape-client.service"], + [SYSTEMCTL, "stop", "landscape-client.service", "--quiet"], check=True, stdout=subprocess.PIPE, )