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