Merge pull request #2 from ruzickap/feature/minor_improvements
Adding watchdog.conf parameters, set "softdog" as default watchdog module, documentation updated
diff --git a/README.rst b/README.rst
index a874481..299053e 100644
--- a/README.rst
+++ b/README.rst
@@ -15,9 +15,17 @@
watchdog:
server:
+ admin: root
enabled: true
+ interval: 1
+ log_dir: /var/log/watchdog
+ realtime: yes
timeout: 60
- # Salt Stack will automatically detect the necessary kernel module which needs to be loaded (ex. hpwdt). You may specify the kernel parameters if needed:
+ device: /dev/watchdog
+
+ # Salt Stack will automatically detect the necessary kernel module which needs to be loaded (ex. hpwdt, iTCO_wdt).
+ # If the hardware model is not predefined in map.jinja the default watchdog driver is used: softdog
+ # You may specify the kernel parameters if needed:
kernel:
parameter:
soft_panic: 1
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index ff77a01..ef199ed 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -2,7 +2,9 @@
###
# Script requirments:
-# apt-get install -y python-yaml virtualenv git
+#apt-get install -y python-yaml virtualenv git
+which virtualenv &> /dev/null || apt-get install -y virtualenv
+
set -e
[ -n "$DEBUG" ] && set -x
diff --git a/watchdog/files/watchdog.conf b/watchdog/files/watchdog.conf
index e79f513..98b4238 100644
--- a/watchdog/files/watchdog.conf
+++ b/watchdog/files/watchdog.conf
@@ -42,6 +42,27 @@
# Check if rsyslogd is still running by enabling the following line
#pidfile = /var/run/rsyslogd.pid
+
+{%- if server.admin is defined %}
+admin = {{ server.admin }}
+{%- endif %}
+
+{%- if server.interval is defined %}
+interval = {{ server.interval }}
+{%- endif %}
+
+{%- if server.log_dir is defined %}
+log-dir = {{ server.log_dir }}
+{%- endif %}
+
+{%- if server.realtime is defined %}
+realtime = {{ server.realtime }}
+{%- endif %}
+
{%- if server.timeout is defined %}
watchdog-timeout = {{ server.timeout }}
{%- endif %}
+
+{%- if server.device is defined %}
+watchdog-device = {{ server.device }}
+{%- endif %}
diff --git a/watchdog/map.jinja b/watchdog/map.jinja
index 60ad291..1699eb1 100644
--- a/watchdog/map.jinja
+++ b/watchdog/map.jinja
@@ -11,7 +11,7 @@
'parameter': {}
}
},
- 'QEMU': {
+ 'default': {
'module': 'softdog',
'kernel': {
'parameter': {}
diff --git a/watchdog/schemas/server.yaml b/watchdog/schemas/server.yaml
index 853a626..4bcd02d 100644
--- a/watchdog/schemas/server.yaml
+++ b/watchdog/schemas/server.yaml
@@ -11,15 +11,20 @@
- enabled
properties:
+ admin:
+ description: |
+ Email address to send admin mail to
+ type: string
+ example: root
enabled:
description: |
Enables Watchdog daemon service
type: boolean
- timeout:
+ interval:
description: |
- Seting "watchdog-timer" config parameter placed in /etc/watchdog.conf
+ Set the interval between two writes to the watchdog device
type: integer
- minimum: 0
+ minimum: 1
kernel:
description: |
Parameters for the kernel module which are used for loading the kernel module
@@ -32,6 +37,26 @@
type: string
items:
$ref: "#/definitions/allow_kdump"
+ log_dir:
+ description: |
+ Set the log directory to capture the standard output and standard error from repair-binary and test-binary execution
+ type: string
+ example: /var/log/watchdog
+ realtime:
+ description: |
+ If set to yes watchdog will lock itself into memory so it is never swapped out
+ type: string
+ example: yes
+ timeout:
+ description: |
+ Seting "watchdog-timer" config parameter placed in /etc/watchdog.conf
+ type: integer
+ minimum: 0
+ device:
+ description: |
+ Set the watchdog device name
+ type: string
+ example: /dev/watchdog
definitions:
# hpwdt
diff --git a/watchdog/server.sls b/watchdog/server.sls
index b2761e5..b831ba6 100644
--- a/watchdog/server.sls
+++ b/watchdog/server.sls
@@ -5,7 +5,6 @@
pkg.installed:
- name: watchdog
-{%- if server.module is defined %}
/etc/default/watchdog:
file.replace:
- name: /etc/default/watchdog
@@ -15,7 +14,7 @@
- pkg: watchdog_packages
- require_in: watchdog_service
-{%- if server.kernel.parameter %}
+{%- if server.kernel.parameter is defined %}
/etc/modprobe.d/kernel_module.conf:
file.managed:
- name: /etc/modprobe.d/{{ server.module }}.conf
@@ -26,7 +25,6 @@
- pkg: watchdog_packages
- require_in: watchdog_service
{%- endif %}
-{%- endif %}
/etc/watchdog.conf:
file.managed: