Fix Ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/watchdog/+bug/1448924
Change-Id: I5c2452c8399b7476ef07190c057b24675055c85c
diff --git a/README.rst b/README.rst
index 299053e..fc69896 100644
--- a/README.rst
+++ b/README.rst
@@ -69,3 +69,11 @@
channel:
#salt-formulas @ irc.freenode.net
+
+
+To-Do
+================
+
+Remove the part in `server.sls` about the Ubuntu Xenial bug once it's fixed in upstream:
+
+https://bugs.launchpad.net/ubuntu/+source/watchdog/+bug/1448924
diff --git a/watchdog/server.sls b/watchdog/server.sls
index 1e83deb..5af0d55 100644
--- a/watchdog/server.sls
+++ b/watchdog/server.sls
@@ -5,6 +5,27 @@
pkg.installed:
- name: watchdog
+#Fix bug https://bugs.launchpad.net/ubuntu/+source/watchdog/+bug/1448924 in Ubuntu Xenial (workaround)
+{% if grains['oscodename'] == 'xenial' %}
+/lib/systemd/system/watchdog.service:
+ file.copy:
+ - name: /etc/systemd/system/watchdog.service
+ - source: /lib/systemd/system/watchdog.service
+ - require:
+ - pkg: watchdog_packages
+ - require_in: /etc/systemd/system/watchdog.service
+
+/etc/systemd/system/watchdog.service:
+ file.line:
+ - name: /etc/systemd/system/watchdog.service
+ - mode: ensure
+ - after: \[Install\]
+ - content: WantedBy=default.target
+ - require:
+ - file: /lib/systemd/system/watchdog.service
+ - require_in: watchdog_service
+{% endif %}
+
/etc/default/watchdog:
file.replace:
- name: /etc/default/watchdog