diff --git a/tools/ocft/apache b/tools/ocft/apache index e93904471..fe4f1930b 100644 --- a/tools/ocft/apache +++ b/tools/ocft/apache @@ -1,63 +1,68 @@ # apache # make sure that your apache configuration loads mod_status CONFIG Agent apache AgentRoot /usr/lib/ocf/resource.d/heartbeat InstallPackage apache2 HangTimeout 20 SETUP-AGENT - /etc/init.d/apache2 start - /etc/init.d/apache2 stop + if systemctl list-unit-files 2>/dev/null | fgrep -q apache2.service; then + systemctl start apache2.service + systemctl stop apache2.service + else + /etc/init.d/apache2 start + /etc/init.d/apache2 stop + fi CASE-BLOCK default_status AgentRun stop CASE-BLOCK prepare Include default_status CASE "check base env" Include prepare AgentRun start OCF_SUCCESS CASE "check base env: set non-existing OCF_RESKEY_statusurl" Include prepare Env OCF_RESKEY_statusurl="yoyoyoyo" AgentRun start OCF_ERR_GENERIC CASE "check base env: set non-existing OCF_RESKEY_configfile" Include prepare Env OCF_RESKEY_configfile="/yoyoyoyo/nosuchfile" AgentRun start OCF_ERR_INSTALLED CASE "normal start" Include prepare AgentRun start OCF_SUCCESS CASE "normal stop" Include prepare AgentRun start AgentRun stop OCF_SUCCESS CASE "double start" Include prepare AgentRun start AgentRun start OCF_SUCCESS CASE "double stop" Include prepare AgentRun stop OCF_SUCCESS CASE "running monitor" Include prepare AgentRun start AgentRun monitor OCF_SUCCESS CASE "not running monitor" Include prepare AgentRun monitor OCF_NOT_RUNNING CASE "unimplemented command" Include prepare AgentRun no_cmd OCF_ERR_UNIMPLEMENTED diff --git a/tools/ocft/exportfs b/tools/ocft/exportfs index 8db482725..618627336 100644 --- a/tools/ocft/exportfs +++ b/tools/ocft/exportfs @@ -1,79 +1,80 @@ # exportfs # # CONFIG Agent exportfs AgentRoot /usr/lib/ocf/resource.d/heartbeat - HangTimeout 40 + InstallPackage nfs-kernel-server + HangTimeout 40 SETUP-AGENT # nothing CASE-BLOCK set_testenv - Env OCF_RESKEY_directory=/usr - Env OCF_RESKEY_fsid=105 - Env OCF_RESKEY_clientspec="*" + Env OCF_RESKEY_directory=/usr + Env OCF_RESKEY_fsid=105 + Env OCF_RESKEY_clientspec="*" Env OCF_RESKEY_CRM_meta_timeout=30000 CASE-BLOCK default_status AgentRun stop CASE-BLOCK prepare - Include set_testenv + Include set_testenv Include default_status CASE "check base env" Include prepare AgentRun start OCF_SUCCESS CASE "check base env: no 'OCF_RESKEY_fsid'" Include prepare Env OCF_RESKEY_fsid= AgentRun start OCF_ERR_CONFIGURED CASE "check base env: invalid 'OCF_RESKEY_directory'" Include prepare Env OCF_RESKEY_directory=/no_such AgentRun start OCF_ERR_INSTALLED CASE "check base env: non-decimal 'OCF_RESKEY_fsid'" Include prepare Env OCF_RESKEY_fsid="4f838db14f838db14f838db14f838db1" AgentRun start OCF_SUCCESS CASE "unimplemented command" Include prepare AgentRun no_cmd OCF_ERR_UNIMPLEMENTED CASE "normal start" Include prepare AgentRun start OCF_SUCCESS CASE "normal stop" Include prepare AgentRun start AgentRun stop OCF_SUCCESS CASE "double start" Include prepare AgentRun start AgentRun start OCF_SUCCESS CASE "double stop" Include prepare AgentRun stop OCF_SUCCESS CASE "stop with no env" Include prepare Env OCF_RESKEY_directory=/no_such AgentRun stop OCF_SUCCESS CASE "started: monitor" Include prepare AgentRun start AgentRun monitor OCF_SUCCESS CASE "not started: monitor" Include prepare AgentRun monitor OCF_NOT_RUNNING diff --git a/tools/ocft/exportfs-multidir b/tools/ocft/exportfs-multidir index 72551c669..2e35e79b2 100644 --- a/tools/ocft/exportfs-multidir +++ b/tools/ocft/exportfs-multidir @@ -1,79 +1,80 @@ # exportfs # # CONFIG Agent exportfs AgentRoot /usr/lib/ocf/resource.d/heartbeat - HangTimeout 40 + InstallPackage nfs-kernel-server + HangTimeout 40 SETUP-AGENT - # nothing + # nothing CASE-BLOCK set_testenv - Env OCF_RESKEY_directory="/usr /var" - Env OCF_RESKEY_fsid=105 - Env OCF_RESKEY_clientspec="*" + Env OCF_RESKEY_directory="/usr /var" + Env OCF_RESKEY_fsid=105 + Env OCF_RESKEY_clientspec="*" Env OCF_RESKEY_CRM_meta_timeout=30000 CASE-BLOCK default_status AgentRun stop CASE-BLOCK prepare - Include set_testenv + Include set_testenv Include default_status CASE "check base env" Include prepare AgentRun start OCF_SUCCESS CASE "check base env: no 'OCF_RESKEY_fsid'" Include prepare Env OCF_RESKEY_fsid= AgentRun start OCF_ERR_CONFIGURED CASE "check base env: invalid 'OCF_RESKEY_directory'" Include prepare Env OCF_RESKEY_directory=/no_such AgentRun start OCF_ERR_INSTALLED CASE "check base env: invalid 'OCF_RESKEY_fsid'" Include prepare Env OCF_RESKEY_fsid=root AgentRun start OCF_ERR_CONFIGURED CASE "unimplemented command" Include prepare AgentRun no_cmd OCF_ERR_UNIMPLEMENTED CASE "normal start" Include prepare AgentRun start OCF_SUCCESS CASE "normal stop" Include prepare AgentRun start AgentRun stop OCF_SUCCESS CASE "double start" Include prepare AgentRun start AgentRun start OCF_SUCCESS CASE "double stop" Include prepare AgentRun stop OCF_SUCCESS CASE "stop with no env" Include prepare Env OCF_RESKEY_directory="/usr /no_such" AgentRun stop OCF_SUCCESS CASE "started: monitor" Include prepare AgentRun start AgentRun monitor OCF_SUCCESS CASE "not started: monitor" Include prepare AgentRun monitor OCF_NOT_RUNNING diff --git a/tools/ocft/mysql b/tools/ocft/mysql index 27fcb587a..305a900a4 100644 --- a/tools/ocft/mysql +++ b/tools/ocft/mysql @@ -1,77 +1,82 @@ # mysql CONFIG Agent mysql AgentRoot /usr/lib/ocf/resource.d/heartbeat InstallPackage mysql HangTimeout 20 SETUP-AGENT - /etc/init.d/mysql start - /etc/init.d/mysql stop + if systemctl list-unit-files 2>/dev/null | fgrep -q mysql.service; then + systemctl start mysql.service + systemctl stop mysql.service + else + /etc/init.d/mysql start + /etc/init.d/mysql stop + fi CASE-BLOCK crm_setting Env OCF_RESKEY_CRM_meta_timeout=15000 CASE-BLOCK default_status AgentRun stop CASE-BLOCK prepare Include crm_setting Include default_status CASE "check base env" Include prepare AgentRun start OCF_SUCCESS CASE "check base env: invalid 'OCF_RESKEY_binary'" Include prepare Env OCF_RESKEY_binary=no_such AgentRun start OCF_ERR_INSTALLED CASE "normal start" Include prepare AgentRun start OCF_SUCCESS CASE "normal stop" Include prepare AgentRun start AgentRun stop OCF_SUCCESS CASE "double start" Include prepare AgentRun start AgentRun start OCF_SUCCESS CASE "double stop" Include prepare AgentRun stop OCF_SUCCESS CASE "running monitor" Include prepare AgentRun start AgentRun monitor OCF_SUCCESS CASE "not running monitor" Include prepare AgentRun monitor OCF_NOT_RUNNING CASE "check lib file" Include prepare Bash chmod u-w /var/lib/mysql BashAtExit chmod u+w /var/lib/mysql AgentRun start OCF_ERR_PERM CASE "unimplemented command" Include prepare AgentRun no_cmd OCF_ERR_UNIMPLEMENTED CASE "non-existent user" Include prepare Env OCF_RESKEY_user=no_user AgentRun start OCF_ERR_INSTALLED CASE "invalid user" Include prepare Env OCF_RESKEY_user=nobody AgentRun start OCF_ERR_PERM diff --git a/tools/ocft/nfsserver b/tools/ocft/nfsserver index 7c69de91a..cf2ac8943 100644 --- a/tools/ocft/nfsserver +++ b/tools/ocft/nfsserver @@ -1,74 +1,69 @@ # nfsserver CONFIG Agent nfsserver AgentRoot /usr/lib/ocf/resource.d/heartbeat - InstallPackage $NFSPKG + InstallPackage nfs-kernel-server HangTimeout 20 SETUP-AGENT INITSCRIPT="" if test -f /etc/init.d/nfsserver; then INITSCRIPT="/etc/init.d/nfsserver" fi - if test -e /etc/SuSE-release; then - NFSPKG=nfs-kernel-server - elif test -e /etc/redhat-release; then - NFSPKG=nfs-utils - fi true CASE-BLOCK required_args Env OCF_RESKEY_nfs_init_script=$INITSCRIPT CASE-BLOCK default_status AgentRun stop CASE-BLOCK prepare Include required_args Include default_status CASE "check base env" Include prepare AgentRun start OCF_SUCCESS CASE "check base env: invalid 'OCF_RESKEY_nfs_init_script'" Include prepare Env OCF_RESKEY_nfs_init_script=no_such_script AgentRun start OCF_ERR_INSTALLED CASE "check base env: invalid 'OCF_RESKEY_nfs_notify_cmd'" Include prepare Env OCF_RESKEY_nfs_notify_cmd=no_such_program AgentRun start OCF_ERR_INSTALLED CASE "normal start" Include prepare AgentRun start OCF_SUCCESS CASE "normal stop" Include prepare AgentRun start AgentRun stop OCF_SUCCESS CASE "double start" Include prepare AgentRun start AgentRun start OCF_SUCCESS CASE "double stop" Include prepare AgentRun stop OCF_SUCCESS CASE "monitor with running" Include prepare AgentRun start AgentRun monitor OCF_SUCCESS CASE "monitor with not running" Include prepare AgentRun monitor OCF_NOT_RUNNING CASE "unimplemented command" Include prepare AgentRun no_cmd OCF_ERR_UNIMPLEMENTED