|
|
0df4b3 |
From 2a224bf7db61094892e0e5ee0cea2c39ce448ecd Mon Sep 17 00:00:00 2001
|
|
|
0df4b3 |
From: Kyle Lape <klape@redhat.com>
|
|
|
0df4b3 |
Date: Thu, 15 Feb 2018 13:00:55 -0600
|
|
|
0df4b3 |
Subject: [PATCH] Scheduling should enable/disable systemd timer
|
|
|
0df4b3 |
|
|
|
0df4b3 |
in addition to start/stop
|
|
|
0df4b3 |
---
|
|
|
0df4b3 |
insights/client/schedule.py | 4 +++-
|
|
|
0df4b3 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
0df4b3 |
|
|
|
0df4b3 |
diff --git a/egg/insights/client/schedule.py b/egg/insights/client/schedule.py
|
|
|
0df4b3 |
index 4a2da14b..404c1aa8 100644
|
|
|
0df4b3 |
--- a/egg/insights/client/schedule.py
|
|
|
0df4b3 |
+++ b/egg/insights/client/schedule.py
|
|
|
0df4b3 |
@@ -56,7 +56,7 @@ class InsightsSchedulerSystemd(object):
|
|
|
0df4b3 |
@property
|
|
|
0df4b3 |
def active(self):
|
|
|
0df4b3 |
try:
|
|
|
0df4b3 |
- systemctl_status = run_command_get_output('systemctl is-active insights-client.timer')
|
|
|
0df4b3 |
+ systemctl_status = run_command_get_output('systemctl is-enabled insights-client.timer')
|
|
|
0df4b3 |
return systemctl_status['status'] == 0
|
|
|
0df4b3 |
except OSError:
|
|
|
0df4b3 |
logger.exception('Could not get systemd status')
|
|
|
0df4b3 |
@@ -67,6 +67,7 @@ class InsightsSchedulerSystemd(object):
|
|
|
0df4b3 |
try:
|
|
|
0df4b3 |
# Start timers in the case of rhel 7 running systemd
|
|
|
0df4b3 |
systemctl_timer = run_command_get_output('systemctl start insights-client.timer')
|
|
|
0df4b3 |
+ systemctl_timer = run_command_get_output('systemctl enable insights-client.timer')
|
|
|
0df4b3 |
logger.debug("Starting Insights Client systemd timer.")
|
|
|
0df4b3 |
logger.debug("Status: %s", systemctl_timer['status'])
|
|
|
0df4b3 |
logger.debug("Output: %s", systemctl_timer['output'])
|
|
|
0df4b3 |
@@ -79,6 +80,7 @@ class InsightsSchedulerSystemd(object):
|
|
|
0df4b3 |
logger.debug('Stopping all systemd timers')
|
|
|
0df4b3 |
try:
|
|
|
0df4b3 |
# Stop timers in the case of rhel 7 running systemd
|
|
|
0df4b3 |
+ systemctl_timer = run_command_get_output('systemctl disable insights-client.timer')
|
|
|
0df4b3 |
systemctl_timer = run_command_get_output('systemctl stop insights-client.timer')
|
|
|
0df4b3 |
logger.debug("Stopping Insights Client systemd timer.")
|
|
|
0df4b3 |
logger.debug("Status: %s", systemctl_timer['status'])
|
|
|
0df4b3 |
--
|
|
|
0df4b3 |
2.14.3
|
|
|
0df4b3 |
|