Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change static value of msgwait to 2 times of watchdog #32

Merged
merged 2 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions runner/ansible/roles/checks/1.3.5/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@
shell: |
DEF_WDTIMEOUT={{ expected[name] }}
result_wdtimeout=${DEF_WDTIMEOUT}
sbdarray=$(grep -E '^SBD_DEVICE=' /etc/sysconfig/sbd | grep -oP 'SBD_DEVICE=\K[^.]+' | sed 's/\"//g')
IFS=';' sbdarray=( $sbdarray )

if [ -f /etc/sysconfig/sbd ]; then
source /etc/sysconfig/sbd
else
exit 1
fi

IFS=';' sbdarray=( $SBD_DEVICE )

for i in "${sbdarray[@]}"
do
wdtimeout=$(/usr/sbin/sbd -d ${i} dump | grep -oP 'Timeout \(watchdog\) *: \K\d+')|| echo ""
device="${i//[[:space:]]/}"
wdtimeout=$(/usr/sbin/sbd -d ${device} dump | grep -oP 'Timeout \(watchdog\) *: \K\d+')|| echo ""
if [[ "${wdtimeout}" -ne "${DEF_WDTIMEOUT}" ]]; then
result_wdtimeout="${wdtimeout}"
fi
done
echo "${result_wdtimeout}"

check_mode: false
register: config_updated
changed_when: config_updated.stdout != expected[name]
Expand All @@ -26,3 +35,4 @@
- ansible_check_mode
vars:
status: "{{ config_updated is not changed }}"

38 changes: 26 additions & 12 deletions runner/ansible/roles/checks/1.3.6/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,32 @@

- name: "{{ name }}.check"
shell: |
DEF_MSGWAIT={{ expected[name] }}
result_msgwait=${DEF_MSGWAIT}
sbdarray=$(grep -E '^SBD_DEVICE=' /etc/sysconfig/sbd | grep -oP 'SBD_DEVICE=\K[^.]+' | sed 's/\"//g')
IFS=';' sbdarray=( $sbdarray )
if [ -f /etc/sysconfig/sbd ]; then
source /etc/sysconfig/sbd
else
exit 1
fi

IFS=';' sbdarray=( $SBD_DEVICE )

for i in "${sbdarray[@]}"
do
msgwait=$(/usr/sbin/sbd -d ${i} dump | grep -oP 'Timeout \(msgwait\) *: \K\d+')|| echo ""
if [[ "${msgwait}" -ne "${DEF_MSGWAIT}" ]]; then
result_msgwait="${msgwait}"
fi
done
echo $result_msgwait
do
device="${i//[[:space:]]/}"
msgwait=$(/usr/sbin/sbd -d ${device} dump | grep -oP 'Timeout \(msgwait\) *: \K\d+')|| echo ""
watchdog=$(/usr/sbin/sbd -d ${device} dump | grep -oP 'Timeout \(watchdog\) *: \K\d+')|| echo ""
declare -i msgwait
declare -i watchdog
let watchdog*=2
if [ $msgwait -lt $watchdog ]; then
exit 1
fi
done
exit 0

register: config_updated
check_mode: false
changed_when: config_updated.stdout != expected[name]
changed_when: config_updated.rc != 0
failed_when: config_updated.rc > 1

- block:
- name: Post results
Expand All @@ -26,3 +37,6 @@
- ansible_check_mode
vars:
status: "{{ config_updated is not changed }}"