Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux-HA: HA-WG-Technical

ocft updated

 

 

Linux-HA ha-wg-technical RSS feed   Index | Next | Previous | View Threaded


jshi at suse

Nov 3, 2011, 5:17 AM

Post #1 of 2 (1015 views)
Permalink
ocft updated

ocft updated.

- Add top level option 'VARIABLE'.
- Add top level option 'CLEANUP-AGENT'.
- Rename Var & Unvar to Env & Unenv.
- Fix a bug about agent installation.
- Modified configs of agent according the new syntax.



For example, test script for LVM can be modified like this:


-------------------------------------------------
# LVM
# by dejan [at] suse on
# Wed Feb 16 13:15:01 CET 2011

CONFIG
#AgentRoot /usr/lib/ocf/resource.d/heartbeat
HangTimeout 20

VARIABLE
OCFT_pv=/var/run/resource-agents/ocft-LVM-pv
OCFT_vg=ocft-vg
OCFT_lv=ocft-lv
OCFT_loop=/dev/loop0

SETUP-AGENT
losetup -d $OCFT_loop 2>/dev/null || true
dd if=/dev/zero of=$OCFT_pv bs=1024k count=1 2>/dev/null
losetup $OCFT_loop $OCFT_pv
pvcreate $OCFT_loop
vgcreate -s 4K $OCFT_vg $OCFT_loop
lvcreate -n $OCFT_lv -L 600K $OCFT_vg

CLEANUP-AGENT
vgchange -an $OCFT_vg
lvremove -f /dev/$OCFT_vg/$OCFT_lv
vgremove -f $OCFT_vg
losetup -d $OCFT_loop
rm $OCFT_pv

CASE-BLOCK required_args
Env OCF_RESKEY_volgrpname=$OCFT_vg

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_volgrpname'"
Include prepare
Env OCF_RESKEY_volgrpname=/dev/no_such_device
AgentRun start OCF_ERR_GENERIC

CASE "check base env: unset 'OCF_RESKEY_volgrpname'"
Include prepare
Unenv OCF_RESKEY_volgrpname
AgentRun start OCF_ERR_CONFIGURED

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 when running"
Include prepare
AgentRun start
AgentRun monitor OCF_SUCCESS

CASE "monitor when not running"
Include prepare
AgentRun monitor OCF_NOT_RUNNING

CASE "unimplemented command"
Include prepare
AgentRun no_cmd OCF_ERR_UNIMPLEMENTED
Attachments: 0001-Medium-ocft-Add-CLEANUP-SETUP-and-VARIABLE-option.patch (52.8 KB)


dejan at suse

Nov 6, 2011, 2:01 PM

Post #2 of 2 (917 views)
Permalink
Re: ocft updated [In reply to]

Hi John,

On Thu, Nov 03, 2011 at 06:17:59AM -0600, John Shi wrote:
>
> ocft updated.
>
> - Add top level option 'VARIABLE'.
> - Add top level option 'CLEANUP-AGENT'.
> - Rename Var & Unvar to Env & Unenv.
> - Fix a bug about agent installation.
> - Modified configs of agent according the new syntax.

Patch pushed. Many thanks for the update!

Cheers,

Dejan

> For example, test script for LVM can be modified like this:
>
>
> -------------------------------------------------
> # LVM
> # by dejan [at] suse on
> # Wed Feb 16 13:15:01 CET 2011
>
> CONFIG
> #AgentRoot /usr/lib/ocf/resource.d/heartbeat
> HangTimeout 20
>
> VARIABLE
> OCFT_pv=/var/run/resource-agents/ocft-LVM-pv
> OCFT_vg=ocft-vg
> OCFT_lv=ocft-lv
> OCFT_loop=/dev/loop0
>
> SETUP-AGENT
> losetup -d $OCFT_loop 2>/dev/null || true
> dd if=/dev/zero of=$OCFT_pv bs=1024k count=1 2>/dev/null
> losetup $OCFT_loop $OCFT_pv
> pvcreate $OCFT_loop
> vgcreate -s 4K $OCFT_vg $OCFT_loop
> lvcreate -n $OCFT_lv -L 600K $OCFT_vg
>
> CLEANUP-AGENT
> vgchange -an $OCFT_vg
> lvremove -f /dev/$OCFT_vg/$OCFT_lv
> vgremove -f $OCFT_vg
> losetup -d $OCFT_loop
> rm $OCFT_pv
>
> CASE-BLOCK required_args
> Env OCF_RESKEY_volgrpname=$OCFT_vg
>
> 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_volgrpname'"
> Include prepare
> Env OCF_RESKEY_volgrpname=/dev/no_such_device
> AgentRun start OCF_ERR_GENERIC
>
> CASE "check base env: unset 'OCF_RESKEY_volgrpname'"
> Include prepare
> Unenv OCF_RESKEY_volgrpname
> AgentRun start OCF_ERR_CONFIGURED
>
> 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 when running"
> Include prepare
> AgentRun start
> AgentRun monitor OCF_SUCCESS
>
> CASE "monitor when not running"
> Include prepare
> AgentRun monitor OCF_NOT_RUNNING
>
> CASE "unimplemented command"
> Include prepare
> AgentRun no_cmd OCF_ERR_UNIMPLEMENTED

> From 082715496bde319d58c46a4e210273ea43fc49a1 Mon Sep 17 00:00:00 2001
> From: John Shi <jshi [at] suse>
> Date: Thu, 3 Nov 2011 19:59:19 +0800
> Subject: [PATCH] Medium: ocft: Add CLEANUP-SETUP and VARIABLE option
>
> ---
> tools/ocft/ChangeLog | 9 +-
> tools/ocft/Filesystem | 41 +++---
> tools/ocft/IPaddr2 | 18 ++--
> tools/ocft/IPsrcaddr | 6 +-
> tools/ocft/LVM | 37 ++---
> tools/ocft/MailTo | 4 +-
> tools/ocft/README.in | 31 +++-
> tools/ocft/README.zh_CN.in | 42 ++++--
> tools/ocft/SendArp | 12 +-
> tools/ocft/apache | 8 +-
> tools/ocft/caselib.in | 106 ++++++--------
> tools/ocft/db2 | 18 ++--
> tools/ocft/iscsi | 31 ++---
> tools/ocft/mysql | 8 +-
> tools/ocft/named | 6 +-
> tools/ocft/nfsserver | 16 +-
> tools/ocft/ocft.in | 338 +++++++++++++++++++++++++++++---------------
> tools/ocft/pgsql | 8 +-
> tools/ocft/portblock | 12 +-
> tools/ocft/postfix | 18 ++--
> 20 files changed, 444 insertions(+), 325 deletions(-)
>
> diff --git a/tools/ocft/ChangeLog b/tools/ocft/ChangeLog
> index 3ae2c1b..9755982 100644
> --- a/tools/ocft/ChangeLog
> +++ b/tools/ocft/ChangeLog
> @@ -1,3 +1,9 @@
> +0.43:
> + - Add top level option 'VARIABLE'.
> + - Add top level option 'CLEANUP-AGENT'.
> + - Rename Var & Unvar to Env & Unenv.
> + - Fix a bug about agent installation.
> + - Modified configs of agent according the new syntax.
> 0.42:
> - Fix a bug about agent installation.
> - The tests stop early if the basic functionality it not there.
> @@ -28,8 +34,7 @@
> - Use 127.0.0.x(and lo for interface) for agents IP*
> 0.4:
> - Add a 'CASE-BLOCK' top option, it can be included by 'CASE'
> - - Add a 'SETUP-AGENT' top option, you can initialize agents before testing.
> - - Add a 'Include' sub-option.
> + - Add a 'SETUP-AGENT' top option, you can initialize agents before testing. - Add a 'Include' sub-option.
> - Add a 'Unvar' sub-option.
> - Rename 'GLOBAL' to 'CONFIG'.
> - Modify a part of syntax.
> diff --git a/tools/ocft/Filesystem b/tools/ocft/Filesystem
> index bbf21d3..65cab58 100644
> --- a/tools/ocft/Filesystem
> +++ b/tools/ocft/Filesystem
> @@ -6,21 +6,12 @@ CONFIG
> #AgentRoot /usr/lib/ocf/resource.d/heartbeat
> HangTimeout 20
>
> -CASE-BLOCK tempvars
> - Var OCFT_fs=/var/run/resource-agents/ocft-Filesystem-fs
> - Var OCFT_loop=/dev/loop0
> - Var OCFT_dir=/var/run/resource-agents/ocft-Filesystem-mnt
> -
> -CASE-BLOCK required_args
> - Include tempvars
> - Var OCF_RESKEY_device=$OCFT_loop
> - Var OCF_RESKEY_fstype=ext2
> - Var OCF_RESKEY_directory=$OCFT_dir
> -
> -SETUP-AGENT
> +VARIABLE
> OCFT_fs=/var/run/resource-agents/ocft-Filesystem-fs
> OCFT_loop=/dev/loop0
> OCFT_dir=/var/run/resource-agents/ocft-Filesystem-mnt
> +
> +SETUP-AGENT
> losetup $OCFT_loop 2>/dev/null && exit 1
> rmdir $OCFT_dir 2>/dev/null || true
> mkdir $OCFT_dir
> @@ -28,6 +19,16 @@ SETUP-AGENT
> mke2fs -Fq $OCFT_fs
> losetup $OCFT_loop $OCFT_fs
>
> +CLEANUP-AGENT
> + rmdir $OCFT_dir
> + rm $OCFT_fs
> + losetup -d $OCFT_loop
> +
> +CASE-BLOCK required_args
> + Env OCF_RESKEY_device=$OCFT_loop
> + Env OCF_RESKEY_fstype=ext2
> + Env OCF_RESKEY_directory=$OCFT_dir
> +
> CASE-BLOCK default_status
> AgentRun stop
>
> @@ -41,12 +42,12 @@ CASE "check base env"
>
> CASE "check base env: invalid 'OCF_RESKEY_device'"
> Include prepare
> - Var OCF_RESKEY_device=/dev/no_such_device
> + Env OCF_RESKEY_device=/dev/no_such_device
> AgentRun start OCF_ERR_INSTALLED
>
> CASE "check base env: unset 'OCF_RESKEY_device'"
> Include prepare
> - Unvar OCF_RESKEY_device
> + Unenv OCF_RESKEY_device
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "normal start"
> @@ -79,13 +80,13 @@ CASE "monitor when not running"
> CASE "monitor depth 10 when running"
> Include prepare
> AgentRun start
> - Var OCF_CHECK_LEVEL=10
> + Env OCF_CHECK_LEVEL=10
> AgentRun monitor OCF_SUCCESS
>
> CASE "monitor depth 20 with running"
> Include prepare
> AgentRun start
> - Var OCF_CHECK_LEVEL=20
> + Env OCF_CHECK_LEVEL=20
> AgentRun monitor OCF_SUCCESS
>
> CASE "start insert failure (remove device)"
> @@ -99,16 +100,10 @@ CASE "monitor depth 20 insert failure (r/o fs)"
> AgentRun start
> Bash mount -o remount,ro $OCFT_dir
> BashAtExit mount -o remount,rw $OCFT_dir
> - Var OCF_CHECK_LEVEL=20
> + Env OCF_CHECK_LEVEL=20
> AgentRun monitor OCF_ERR_GENERIC
>
> CASE "unimplemented command"
> Include prepare
> AgentRun no_cmd OCF_ERR_UNIMPLEMENTED
>
> -CASE "meta-data and cleanup"
> - Include prepare
> - Bash rmdir $OCFT_dir
> - Bash rm $OCFT_fs
> - Bash losetup -d $OCFT_loop
> - AgentRun meta-data OCF_SUCCESS
> diff --git a/tools/ocft/IPaddr2 b/tools/ocft/IPaddr2
> index e4ff697..3a0c3ea 100644
> --- a/tools/ocft/IPaddr2
> +++ b/tools/ocft/IPaddr2
> @@ -6,7 +6,7 @@ CONFIG
> HangTimeout 20
>
> CASE-BLOCK required_args
> - Var OCF_RESKEY_ip=127.0.0.3
> + Env OCF_RESKEY_ip=127.0.0.3
>
> CASE-BLOCK default_status
> AgentRun stop
> @@ -21,42 +21,42 @@ CASE "check base env"
>
> CASE "check base env: unset 'OCF_RESKEY_ip'"
> Include prepare
> - Unvar OCF_RESKEY_ip
> + Unenv OCF_RESKEY_ip
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "check base env: set invalid 'OCF_RESKEY_ip'"
> Include prepare
> - Var OCF_RESKEY_ip=not_ip_address
> + Env OCF_RESKEY_ip=not_ip_address
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "check base env: set 'OCF_RESKEY_cidr_netmask'"
> Include prepare
> - Var OCF_RESKEY_cidr_netmask=8
> + Env OCF_RESKEY_cidr_netmask=8
> AgentRun start OCF_SUCCESS
>
> CASE "check base env: set invalid 'OCF_RESKEY_cidr_netmask'"
> Include prepare
> - Var OCF_RESKEY_cidr_netmask=not_netmask
> + Env OCF_RESKEY_cidr_netmask=not_netmask
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "check base env: set 'OCF_RESKEY_broadcast'"
> Include prepare
> - Var OCF_RESKEY_broadcast=127.255.255.255
> + Env OCF_RESKEY_broadcast=127.255.255.255
> AgentRun start OCF_SUCCESS
>
> CASE "check base env: set invalid 'OCF_RESKEY_broadcast'"
> Include prepare
> - Var OCF_RESKEY_broadcast=not_broadcast
> + Env OCF_RESKEY_broadcast=not_broadcast
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "check base env: set 'OCF_RESKEY_nic'"
> Include prepare
> - Var OCF_RESKEY_nic=lo
> + Env OCF_RESKEY_nic=lo
> AgentRun start OCF_SUCCESS
>
> CASE "check base env: set invalid 'OCF_RESKEY_nic'"
> Include prepare
> - Var OCF_RESKEY_nic=not_nic
> + Env OCF_RESKEY_nic=not_nic
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "normal start"
> diff --git a/tools/ocft/IPsrcaddr b/tools/ocft/IPsrcaddr
> index 51434a4..cf3145b 100644
> --- a/tools/ocft/IPsrcaddr
> +++ b/tools/ocft/IPsrcaddr
> @@ -6,7 +6,7 @@ CONFIG
> HangTimeout 20
>
> CASE-BLOCK required_args
> - Var OCF_RESKEY_ipaddress=127.0.0.3
> + Env OCF_RESKEY_ipaddress=127.0.0.3
>
> CASE-BLOCK default_status
> AgentRun stop
> @@ -21,12 +21,12 @@ CASE "check base env"
>
> CASE "check base env: unset 'OCF_RESKEY_ipaddress'"
> Include prepare
> - Unvar OCF_RESKEY_ipaddress
> + Unenv OCF_RESKEY_ipaddress
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "check base env: set invalid 'OCF_RESKEY_ipaddress'"
> Include prepare
> - Var OCF_RESKEY_ipaddress=not_ip_address
> + Env OCF_RESKEY_ipaddress=not_ip_address
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "normal start"
> diff --git a/tools/ocft/LVM b/tools/ocft/LVM
> index 9935485..e5a41a4 100644
> --- a/tools/ocft/LVM
> +++ b/tools/ocft/LVM
> @@ -6,21 +6,13 @@ CONFIG
> #AgentRoot /usr/lib/ocf/resource.d/heartbeat
> HangTimeout 20
>
> -CASE-BLOCK tempvars
> - Var OCFT_pv=/var/run/resource-agents/ocft-LVM-pv
> - Var OCFT_vg=ocft-vg
> - Var OCFT_lv=ocft-lv
> - Var OCFT_loop=/dev/loop0
> -
> -CASE-BLOCK required_args
> - Include tempvars
> - Var OCF_RESKEY_volgrpname=$OCFT_vg
> -
> -SETUP-AGENT
> +VARIABLE
> OCFT_pv=/var/run/resource-agents/ocft-LVM-pv
> OCFT_vg=ocft-vg
> OCFT_lv=ocft-lv
> OCFT_loop=/dev/loop0
> +
> +SETUP-AGENT
> losetup -d $OCFT_loop 2>/dev/null || true
> dd if=/dev/zero of=$OCFT_pv bs=1024k count=1 2>/dev/null
> losetup $OCFT_loop $OCFT_pv
> @@ -28,6 +20,16 @@ SETUP-AGENT
> vgcreate -s 4K $OCFT_vg $OCFT_loop
> lvcreate -n $OCFT_lv -L 600K $OCFT_vg
>
> +CLEANUP-AGENT
> + vgchange -an $OCFT_vg
> + lvremove -f /dev/$OCFT_vg/$OCFT_lv
> + vgremove -f $OCFT_vg
> + losetup -d $OCFT_loop
> + rm $OCFT_pv
> +
> +CASE-BLOCK required_args
> + Env OCF_RESKEY_volgrpname=$OCFT_vg
> +
> CASE-BLOCK default_status
> AgentRun stop
>
> @@ -41,12 +43,12 @@ CASE "check base env"
>
> CASE "check base env: invalid 'OCF_RESKEY_volgrpname'"
> Include prepare
> - Var OCF_RESKEY_volgrpname=/dev/no_such_device
> + Env OCF_RESKEY_volgrpname=/dev/no_such_device
> AgentRun start OCF_ERR_GENERIC
>
> CASE "check base env: unset 'OCF_RESKEY_volgrpname'"
> Include prepare
> - Unvar OCF_RESKEY_volgrpname
> + Unenv OCF_RESKEY_volgrpname
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "normal start"
> @@ -80,12 +82,3 @@ CASE "unimplemented command"
> Include prepare
> AgentRun no_cmd OCF_ERR_UNIMPLEMENTED
>
> -CASE "meta-data and cleanup"
> - Include prepare
> - Bash vgchange -an $OCFT_vg
> - Bash lvremove -f /dev/$OCFT_vg/$OCFT_lv
> - Bash vgremove -f $OCFT_vg
> - Bash losetup -d $OCFT_loop
> - Bash rm $OCFT_pv
> - Bash rm /tmp/.LVM_set
> - AgentRun meta-data OCF_SUCCESS
> diff --git a/tools/ocft/MailTo b/tools/ocft/MailTo
> index 9031c51..f9beae2 100644
> --- a/tools/ocft/MailTo
> +++ b/tools/ocft/MailTo
> @@ -6,7 +6,7 @@ CONFIG
> HangTimeout 20
>
> CASE-BLOCK required_args
> - Var OCF_RESKEY_email=root [at] localhos
> + Env OCF_RESKEY_email=root [at] localhos
>
> CASE-BLOCK default_status
> AgentRun stop
> @@ -21,7 +21,7 @@ CASE "check base env"
>
> CASE "check base env: unset 'OCF_RESKEY_email'"
> Include prepare
> - Unvar OCF_RESKEY_email
> + Unenv OCF_RESKEY_email
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "normal start"
> diff --git a/tools/ocft/README.in b/tools/ocft/README.in
> index 8d69a5d..3f6e16a 100644
> --- a/tools/ocft/README.in
> +++ b/tools/ocft/README.in
> @@ -43,7 +43,7 @@ INTRODUCTION & DESIGN
> HOW TO WRITE CONFIGURATION FILE
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> - - There are only 4 top level options that are all spelled by capital letters and "-".
> + - There are only 6 top level options that are all spelled by capital letters and "-".
> Every top level option contains sub-options that they are initials.
>
> * 'CONFIG' (top level option)
> @@ -66,14 +66,29 @@ HOW TO WRITE CONFIGURATION FILE
> which will influence the running of the following test case. Hence timeout setting is
> needed, if the resource agent stops timeout, the scripts will kill this resource agent.
>
> +* 'VARIABLE' (top level option)
> + - Garmmar:
> + VARIABLE
> + VAR1=value1
> + VAR2=value2
> + ...
> + - Define the global variable here, the variables can be visited everywhere, they can be referenced
> + using $VAR_NAME. Note, the variables in VARIABLE are different from 'Env VAR1=value1', 'Env' can
> + affect the activity of agent, but the variables in VARIABLE just be shared with top level option.
> +
> * 'SETUP-AGENT' (top level option)
> - Grammar:
> SETUP-AGENT
> bash scripts...
> ...
> - - Some of Agents may need to be initialized before testing, you can do it here with bash
> - script. The initialization will only be executed once, if you want to reinitialize it,
> - you can manually delete the flag file at /tmp/.[AGENT_NAME]_set.
> + - Some of Agents may need to be initialized before testing, you can do it here with bash script.
> +
> +* 'CLEANUP-AGENT' (top level option)
> + - Garmmar:
> + CLEANUP-AGENT
> + bash scripts...
> + ...
> + - If SETUP-AGENT set, usually you might be use this option do some cleaning work after test.
>
> * 'CASE' & 'CASE-BLOCK' (top level option)
> - Grammar: CASE "description" & CASE-BLOCK macro_name
> @@ -90,13 +105,13 @@ HOW TO WRITE CONFIGURATION FILE
> The "CASE-BLOCK" option is a macro definer, the statements in "CASE-BLOCK" will be inserted
> into "CASE" if you "Include" the "macro_name".
>
> - ** 'Var' (sub-option)
> - - Grammar: Var VARIABLE=value
> + ** 'Env' (sub-option)
> + - Grammar: Env VARIABLE=value
> - It is to set up an environment variable of the resource agent. They usually appear to
> be OCF_RESKEY_xxx. One point is to be noted is there is no blank by both sides of "=".
>
> - ** 'Unvar' (sub-option)
> - - Grammer: Unvar VARIABLE [VARIABLE2 [...]]
> + ** 'Unenv' (sub-option)
> + - Grammer: Unenv VARIABLE [VARIABLE2 [...]]
> - Remove the environment variable.
>
> ** 'Include' (sub-option)
> diff --git a/tools/ocft/README.zh_CN.in b/tools/ocft/README.zh_CN.in
> index 3d08937..65dac04 100644
> --- a/tools/ocft/README.zh_CN.in
> +++ b/tools/ocft/README.zh_CN.in
> @@ -29,7 +29,7 @@ ocft ???????????????????????????resouce agents??????????????????????????????reso
> ??????resource agent???????????????????????????????????????????????????resource agent???bug??????
>
> 2 ??????
> -????????????top level option??????????????????????????????'-'??????????????????top level option????????????sub-option???
> +??????6???top level option??????????????????????????????'-'??????????????????top level option????????????sub-option???
> ???????????????????????????
>
> 2.1 'CONFIG' ??????
> @@ -52,15 +52,31 @@ package_name?????????resouce agent???????????????????????????????????????
> ?????????test case??????????????????????????????????????????????????????resouce agent??????????????????????????????
> ????????????resouce agent???
>
> -2.2 'SETUP-AGENT' ??????
> +2.2 'VARIABLE' ??????
> +?????????
> +VARIABLE
> + VAR1=value1
> + VAR2=value2
> + ...
> +??????????????????????????????????????????????????????????????????????????????????????????????????????????????????$?????????????????????
> +???????????????Env??????????????????Env????????????????????????????????????agent??????????????????????????????????????????????????????
> +?????????
> +
> +2.3 'SETUP-AGENT' ??????
> ?????????
> SETUP-AGENT
> bash scripts...
> ...
> -??????Agent????????????????????????????????????????????????bash???????????????????????????????????????????????????????????????
> -??????????????????????????????????????????????????????????????? /tmp/.[AGENT_NAME]_set???
> +??????Agent????????????????????????????????????????????????bash????????????????????????
> +
> +2.4 'CLEANUP-AGENT' ??????
> +?????????
> +CLEANUP-AGENT
> + bash scripts...
> + ...
> +?????????????????????SETUP-AGENT, ???????????????????????????????????????????????????????????????
>
> -2.3 'CASE' & 'CASE-BLOCK' ??????
> +2.5 'CASE' & 'CASE-BLOCK' ??????
> ?????????CASE "description" & CASE-BLOCK macro_name
> ????????????????????????????????????????????????????????????????????????????????? 'CASE "..."'?????????????????????????????????
> ???????????????????????????????????????????????????????????????shell???????????????????????????????????????????????????????????????
> @@ -70,31 +86,31 @@ test case???????????????????????????????????????shell???????????????????????????
> ????????????????????????shell??????????????????shell????????????
> 'CASE-BLOCK'??????????????????????????????????????????????????????????????????"CASE"????????????
>
> -2.3.1 'Var' ??????
> -?????????Var VARIABLE=value
> +2.5.1 'Env' ??????
> +?????????Env VARIABLE=value
> ????????????resouce agent?????????????????????????????????OCF_RESKEY_xxx?????????=???????????????????????????
>
> -2.3.2 'Unvar' ??????
> -?????????Unvar VARIABLE
> +2.5.2 'Unenv' ??????
> +?????????Unenv VARIABLE
> ????????????????????????????????????
>
> -2.3.3 'Include' ??????
> +2.5.3 'Include' ??????
> ?????????Include macro_name
> ?????????????????????"macro_name"?????????????????????????????????????????????"CASE-BLOCK"????????????"macro_name"
> ????????????
>
> -2.3.4 'Bash' ??????
> +2.5.4 'Bash' ??????
> ?????????Bash bash_codes
> ????????????????????????os???????????????????????????bash????????????????????????????????????????????????????????????????????????
> ?????????????????????????????????
>
> -2.3.5 'BashAtExit' ??????
> +2.5.5 'BashAtExit' ??????
> ?????????BashAtExit bash_codes
> ????????????????????????os???????????????????????????test case?????????????????????????????????????????????'Bash'?????????
> ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
> ?????????????????????BashAtExit????????????????????????????????????????????????
>
> -2.3.6 'RunAgent' ??????
> +2.5.6 'RunAgent' ??????
> ?????????RunAgent cmd [ret_value]
> ???option????????????resouce agent???'cmd' ??????resouce agent??????????????? start???status???stop ...
> ??????????????????????????????????????????????????????????????????????????????????????????resouce agent??????????????????
> diff --git a/tools/ocft/SendArp b/tools/ocft/SendArp
> index 448d6d4..ee46e39 100644
> --- a/tools/ocft/SendArp
> +++ b/tools/ocft/SendArp
> @@ -6,8 +6,8 @@ CONFIG
> HangTimeout 15
>
> CASE-BLOCK required_args
> - Var OCF_RESKEY_ip=127.0.0.1
> - Var OCF_RESKEY_nic=lo
> + Env OCF_RESKEY_ip=127.0.0.1
> + Env OCF_RESKEY_nic=lo
>
> CASE-BLOCK default_status
> AgentRun stop
> @@ -22,22 +22,22 @@ CASE "check base env"
>
> CASE "check base env: unset 'OCF_RESKEY_ip'"
> Include prepare
> - Unvar OCF_RESKEY_ip
> + Unenv OCF_RESKEY_ip
> AgentRun start OCF_ERR_ARGS
>
> CASE "check base env: set worng 'OCF_RESKEY_ip'"
> Include prepare
> - Var OCF_RESKEY_ip=not_ip_address
> + Env OCF_RESKEY_ip=not_ip_address
> AgentRun start OCF_ERR_ARGS
>
> CASE "check base env: unset 'OCF_RESKEY_nic'"
> Include prepare
> - Unvar OCF_RESKEY_nic
> + Unenv OCF_RESKEY_nic
> AgentRun start OCF_ERR_ARGS
>
> CASE "check base env: set worng 'OCF_RESKEY_nic'"
> Include prepare
> - Var OCF_RESKEY_nic=not_nic
> + Env OCF_RESKEY_nic=not_nic
> AgentRun start OCF_ERR_ARGS
>
> CASE "normal start"
> diff --git a/tools/ocft/apache b/tools/ocft/apache
> index dc8ca26..f444d51 100644
> --- a/tools/ocft/apache
> +++ b/tools/ocft/apache
> @@ -10,8 +10,8 @@ SETUP-AGENT
> /etc/init.d/apache2 stop
>
> CASE-BLOCK required_args
> - Var OCF_RESKEY_statusurl=http://localhost/info2html.css
> - Var OCF_RESKEY_testregex='This is'
> + Env OCF_RESKEY_statusurl=http://localhost/info2html.css
> + Env OCF_RESKEY_testregex='This is'
>
> CASE-BLOCK default_status
> AgentRun stop
> @@ -26,12 +26,12 @@ CASE "check base env"
>
> CASE "check base env: unset OCF_RESKEY_statusurl"
> Include prepare
> - Unvar OCF_RESKEY_statusurl
> + Unenv OCF_RESKEY_statusurl
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "check base env: unset OCF_RESKEY_testregex"
> Include prepare
> - Unvar OCF_RESKEY_testregex
> + Unenv OCF_RESKEY_testregex
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "normal start"
> diff --git a/tools/ocft/caselib.in b/tools/ocft/caselib.in
> index ab464f6..0617bfd 100644
> --- a/tools/ocft/caselib.in
> +++ b/tools/ocft/caselib.in
> @@ -1,5 +1,5 @@
> #
> -# Copyright (c) 2010 Novell Inc, John Shi
> +# Copyright (c) 2010-2011 Novell Inc, John Shi
> # All Rights Reserved.
> #
> # This program is free software; you can redistribute it and/or modify
> @@ -27,12 +27,12 @@ quit()
> local ret
> ret="$1"
>
> - while [ $atexit_num -gt 0 ]; do
> - atexit$atexit_num
> - let atexit_num--
> + while [ $__OCFT__atexit_num -gt 0 ]; do
> + atexit$__OCFT__atexit_num
> + let __OCFT__atexit_num--
> done
>
> - rm -rf $fakebin
> + rm -rf $__OCFT__fakebin
>
> exit $ret
> }
> @@ -48,11 +48,11 @@ agent_install()
> for pkg in "$@"; do
> if [ -e /etc/SuSE-release ]; then
> if ! rpm -ql "$pkg" >/dev/null 2>&1; then
> - echo -n "${showhost}Installing $pkg ..."
> + echo "${__OCFT__showhost}Installing $pkg ..."
> zypper -q install -y "$pkg" >/dev/null 2>&1
> if ! rpm -ql "$pkg" >/dev/null 2>&1; then
> echo
> - echo "${showhost}ERROR: Install '$pkg' failed, break this case."
> + echo "${__OCFT__showhost}ERROR: Install '$pkg' failed."
> quit 2
> fi
> echo "done"
> @@ -60,11 +60,11 @@ agent_install()
> fi
> elif [ -e /etc/debian_version ]; then
> if ! dpkg -L "$pkg" >/dev/null 2>&1; then
> - echo -n "${showhost}Installing $pkg ..."
> + echo "${__OCFT__showhost}Installing $pkg ..."
> apt-get -y install "$pkg" >/dev/null 2>&1
> if ! dpkg -L "$pkg" >/dev/null 2>&1; then
> echo
> - echo "${showhost}ERROR: Install '$pkg' failed, break this case."
> + echo "${__OCFT__showhost}ERROR: Install '$pkg' failed."
> quit 2
> fi
> echo "done"
> @@ -72,37 +72,23 @@ agent_install()
> fi
> elif [ -e /etc/redhat-release ]; then
> if ! rpm -ql "$pkg" >/dev/null 2>&1; then
> - echo -n "${showhost}Installing $pkg ..."
> + echo "${__OCFT__showhost}Installing $pkg ..."
> yum -y install "$pkg" >/dev/null 2>&1
> if ! rpm -ql "$pkg" >/dev/null 2>&1; then
> echo
> - echo "${showhost}ERROR: Install '$pkg' failed, break this case."
> + echo "${__OCFT__showhost}ERROR: Install '$pkg' failed."
> quit 2
> fi
> echo "done"
> echo
> fi
> else
> - echo "${showhost}ERROR: Cannot detect your OS type, break this case."
> + echo "${__OCFT__showhost}ERROR: Cannot detect your OS type."
> quit 2
> fi
> done
> }
>
> -agent_setup()
> -{
> - local agent
> - agent="$1"
> -
> - if [ ! -e "/tmp/.${agent}_set" ]; then
> - touch "/tmp/.${agent}_set"
> - echo -n "${showhost}Initialing ${agent}..."
> - bash >/dev/null
> - echo "done"
> - echo
> - fi
> -}
> -
> agent_run()
> {
> local agent cmd timeout pid i ret aroot
> @@ -110,7 +96,7 @@ agent_run()
> cmd="$2"
> timeout="$3"
>
> - aroot=${MYROOT:-$AGENT_ROOT}
> + aroot=${__OCFT__MYROOT:-$__OCFT__AGENT_ROOT}
>
> setsid $aroot/$agent $cmd >/tmp/.ocft_runlog 2>&1 &
> pid=$!
> @@ -128,8 +114,8 @@ agent_run()
> kill -SIGTERM -$pid >/dev/null 2>&1
> sleep 3
> kill -SIGKILL -$pid >/dev/null 2>&1
> - echo -n "${showhost}ERROR: The agent was hanging, killed it, "
> - echo "maybe you damaged the agent or system's environment, break this CASE."
> + echo -n "${__OCFT__showhost}ERROR: The agent was hanging, killed it, "
> + echo "maybe you damaged the agent or system's environment."
> echo
> quit 1
> fi
> @@ -144,7 +130,7 @@ check_success()
> msg="$2"
>
> if [ $ret -ne 0 ]; then
> - echo "${showhost}ERROR: '${msg}' failed, the return code is ${ret}, break this CASE."
> + echo "${__OCFT__showhost}ERROR: '${msg}' failed, the return code is ${ret}."
> quit 1
> fi
> }
> @@ -174,19 +160,19 @@ backbash_start()
> local host fd rfd wfd
> host="$1"
>
> - if [ ! -d "$CASES_DIR" ]; then
> - echo "${showhost}ERROR: Could not found Directory: ${CASES_DIR}."
> + if [ ! -d "$__OCFT__CASES_DIR" ]; then
> + echo "${__OCFT__showhost}ERROR: Could not found Directory: ${__OCFT__CASES_DIR}."
> quit 1
> fi
>
> - if lsof $CASES_DIR/${host}_r $CASES_DIR/${host}_w >/dev/null 2>&1; then
> - echo "${showhost}ERROR: Connection exist with $host, break this CASE."
> + if lsof $__OCFT__CASES_DIR/${host}_r $__OCFT__CASES_DIR/${host}_w >/dev/null 2>&1; then
> + echo "${__OCFT__showhost}ERROR: Connection exist with $host."
> quit 1
> fi
> - if [ ! -p "$CASES_DIR/${host}_r" ] || [ ! -p "$CASES_DIR/${host}_w" ]; then
> - rm -f $CASES_DIR/${host}_r $CASES_DIR/${host}_w
> - if ! mkfifo $CASES_DIR/${host}_r $CASES_DIR/${host}_w >/dev/null 2>&1; then
> - echo "${showhost}ERROR: Could not create pipe file: $CASES_DIR/${host}_*, break this CASE."
> + if [ ! -p "$__OCFT__CASES_DIR/${host}_r" ] || [ ! -p "$__OCFT__CASES_DIR/${host}_w" ]; then
> + rm -f $__OCFT__CASES_DIR/${host}_r $__OCFT__CASES_DIR/${host}_w
> + if ! mkfifo $__OCFT__CASES_DIR/${host}_r $__OCFT__CASES_DIR/${host}_w >/dev/null 2>&1; then
> + echo "${__OCFT__showhost}ERROR: Could not create pipe file: $__OCFT__CASES_DIR/${host}_*."
> quit 1
> fi
> fi
> @@ -194,12 +180,12 @@ backbash_start()
> ssh root@$host '/bin/bash 2>&1
> sed "s/00/001/g" /tmp/.backbash-log
> echo 000
> - echo 1' >$CASES_DIR/${host}_r <$CASES_DIR/${host}_w &
> + echo 1' >$__OCFT__CASES_DIR/${host}_r <$__OCFT__CASES_DIR/${host}_w &
>
> fd=$(__maxfd)
> rfd=$(expr $fd + 1)
> wfd=$(expr $fd + 2)
> - eval "exec ${rfd}<$CASES_DIR/${host}_r ${wfd}>$CASES_DIR/${host}_w"
> + eval "exec ${rfd}<$__OCFT__CASES_DIR/${host}_r ${wfd}>$__OCFT__CASES_DIR/${host}_w"
> }
>
> backbash()
> @@ -211,7 +197,7 @@ backbash()
> wfd=$(__getfd $host w)
>
> if [ -z "$rfd" -o -z "$wfd" ]; then
> - echo "${showhost}ERROR: Could not found connection with $host, break this CASE."
> + echo "${__OCFT__showhost}ERROR: Could not found connection with $host."
> fi
>
> cat >&$wfd <<EOF
> @@ -227,7 +213,7 @@ echo 000
> echo 0
> EOF
> if [ $? -ne 0 ]; then
> - echo "${showhost}ERROR: Broken connection with $host, break this CASE."
> + echo "${__OCFT__showhost}ERROR: Broken connection with $host."
> quit 1
> fi
>
> @@ -250,7 +236,7 @@ EOF
> quit 1
> ;;
> 2)
> - echo "${showhost}ERROR: Broken connection with $host, break this CASE."
> + echo "${__OCFT__showhost}ERROR: Broken connection with $host."
> quit 1
> ;;
> esac
> @@ -265,43 +251,43 @@ backbash_stop()
> if [ -n "$wfd" ]; then
> cat >&$wfd <<<'quit 0'
> fi
> - rm -f $CASES_DIR/${host}_r $CASES_DIR/${host}_w
> + rm -f $__OCFT__CASES_DIR/${host}_r $__OCFT__CASES_DIR/${host}_w
> }
>
>
> export OCF_ROOT=@OCF_ROOT_DIR@
> export OCF_LIB=@OCF_LIB_DIR@/heartbeat
> -AGENT_ROOT=@OCF_RA_DIR@/heartbeat
> -CASES_DIR=/var/lib/@PACKAGE_NAME@/ocft/cases
> +__OCFT__AGENT_ROOT=@OCF_RA_DIR@/heartbeat
> +__OCFT__CASES_DIR=/var/lib/@PACKAGE_NAME@/ocft/cases
>
> -atexit_num=0
> +__OCFT__atexit_num=0
>
> if [ $EUID -ne 0 ]; then
> - echo "${showhost}ERROR: '$0' needs to be run by root, break this CASE."
> + echo "${__OCFT__showhost}ERROR: '$0' needs to be run by root."
> quit 3
> fi
>
> -fakebin=./fakebin
> +__OCFT__fakebin=./fakebin
>
> -mkdir -p $fakebin >/dev/null 2>&1 &&
> -ln -sf /bin/true $fakebin/crm_master >/dev/null 2>&1 &&
> -ln -sf /bin/true $fakebin/crm_mon >/dev/null 2>&1
> +mkdir -p $__OCFT__fakebin >/dev/null 2>&1 &&
> +ln -sf /bin/true $__OCFT__fakebin/crm_master >/dev/null 2>&1 &&
> +ln -sf /bin/true $__OCFT__fakebin/crm_mon >/dev/null 2>&1
> if [ $? -ne 0 ]; then
> - echo "${showhost}ERROR: initialize 'fakebin' failed, break this CASE."
> + echo "${__OCFT__showhost}ERROR: initialize 'fakebin' failed."
> quit 3
> fi
> -export HA_SBIN_DIR=$fakebin
> +export HA_SBIN_DIR=$__OCFT__fakebin
>
> . $OCF_LIB/ocf-returncodes || {
> - echo "${showhost}ERROR: $OCF_LIB/ocf-returncodes not found, break this CASE."
> + echo "${__OCFT__showhost}ERROR: $OCF_LIB/ocf-returncodes not found."
> quit 3
> }
>
> -while read line; do
> - if [ -n "$line" ]; then
> - retn=${line%%=*}
> - reti=$(eval echo \$$retn)
> - retval[reti]=$retn
> +while read __OCFT__line; do
> + if [ -n "$__OCFT__line" ]; then
> + __OCFT__retn=${__OCFT__line%%=*}
> + __OCFT__reti=$(eval echo \$$__OCFT__retn)
> + __OCFT__retval[__OCFT__reti]=$__OCFT__retn
> fi
> done <<<"$(sed 's/#.*//' $OCF_LIB/ocf-returncodes)"
>
> diff --git a/tools/ocft/db2 b/tools/ocft/db2
> index 4bcd23a..9b69350 100644
> --- a/tools/ocft/db2
> +++ b/tools/ocft/db2
> @@ -36,12 +36,12 @@ SETUP-AGENT
> # nothing
>
> CASE-BLOCK set_testenv
> - Var OCFT_instance=db2inst1
> - Var OCFT_db=ocft
> + Env OCFT_instance=db2inst1
> + Env OCFT_db=ocft
>
> CASE-BLOCK crm_setting
> - Var OCF_RESKEY_instance=$OCFT_instance
> - Var OCF_RESKEY_CRM_meta_timeout=30000
> + Env OCF_RESKEY_instance=$OCFT_instance
> + Env OCF_RESKEY_CRM_meta_timeout=30000
>
> CASE-BLOCK default_status
> AgentRun stop
> @@ -57,7 +57,7 @@ CASE "check base env"
>
> CASE "check base env: invalid 'OCF_RESKEY_instance'"
> Include prepare
> - Var OCF_RESKEY_instance=no_such
> + Env OCF_RESKEY_instance=no_such
> AgentRun start OCF_ERR_INSTALLED
>
> CASE "invalid instance config"
> @@ -108,8 +108,8 @@ CASE "killed instance: monitor"
>
> CASE "overload param instance by admin"
> Include prepare
> - Var OCF_RESKEY_instance=no_such
> - Var OCF_RESKEY_admin=$OCFT_instance
> + Env OCF_RESKEY_instance=no_such
> + Env OCF_RESKEY_admin=$OCFT_instance
> AgentRun start OCF_SUCCESS
>
> CASE "check start really activates db"
> @@ -126,7 +126,7 @@ CASE "multipartion test"
> AgentRun monitor OCF_SUCCESS
>
> # start does not start partion 1
> - Var OCF_RESKEY_dbpartitionnum=1
> + Env OCF_RESKEY_dbpartitionnum=1
> AgentRun monitor OCF_NOT_RUNNING
>
> # now start 1
> @@ -138,7 +138,7 @@ CASE "multipartion test"
> AgentRun monitor OCF_NOT_RUNNING
>
> # does not affect 0
> - Var OCF_RESKEY_dbpartitionnum=0
> + Env OCF_RESKEY_dbpartitionnum=0
> AgentRun monitor OCF_SUCCESS
>
> # fault injection does not work on the 1.0.4 client due to a hardcoded path
> diff --git a/tools/ocft/iscsi b/tools/ocft/iscsi
> index fea6f74..0b09a25 100644
> --- a/tools/ocft/iscsi
> +++ b/tools/ocft/iscsi
> @@ -6,20 +6,12 @@ CONFIG
> InstallPackage iscsitarget
> HangTimeout 20
>
> -CASE-BLOCK tempvars
> - Var OCFT_disk=/var/run/resource-agents/ocft-iscsi
> - Var OCFT_target="iqn.2011-03.ocft.localhost:disk0"
> - Var OCFT_portal="127.0.0.1:3260"
> -
> -CASE-BLOCK required_args
> - Include tempvars
> - Var OCF_RESKEY_portal=$OCFT_portal
> - Var OCF_RESKEY_target=$OCFT_target
> -
> -SETUP-AGENT
> +VARIABLE
> OCFT_disk=/var/run/resource-agents/ocft-iscsi
> OCFT_target="iqn.2011-03.ocft.localhost:disk0"
> OCFT_portal="127.0.0.1:3260"
> +
> +SETUP-AGENT
> dd if=/dev/zero of=$OCFT_disk bs=1024k count=1 2>/dev/null
> echo Target $OCFT_target >> /etc/ietd.conf
> echo " Lun 0 Path=$OCFT_disk,Type=fileio" >> /etc/ietd.conf
> @@ -27,6 +19,14 @@ SETUP-AGENT
> /etc/init.d/open-iscsi start
> /etc/init.d/iscsitarget restart
>
> +CLEANUP-AGENT
> + rm -f $OCFT_disk
> + sed -i "/^Target $OCFT_target/,+1d" /etc/ietd.conf
> +
> +CASE-BLOCK required_args
> + Env OCF_RESKEY_portal=$OCFT_portal
> + Env OCF_RESKEY_target=$OCFT_target
> +
> CASE-BLOCK default_status
> AgentRun stop
>
> @@ -40,12 +40,12 @@ CASE "check base env"
>
> CASE "check base env: invalid 'OCF_RESKEY_portal'"
> Include prepare
> - Unvar OCF_RESKEY_portal
> + Unenv OCF_RESKEY_portal
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "check base env: unset 'OCF_RESKEY_target'"
> Include prepare
> - Unvar OCF_RESKEY_target
> + Unenv OCF_RESKEY_target
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "normal start"
> @@ -79,8 +79,3 @@ CASE "unimplemented command"
> Include prepare
> AgentRun no_cmd OCF_ERR_UNIMPLEMENTED
>
> -CASE "meta-data and cleanup"
> - Include prepare
> - Bash rm -f $OCFT_disk
> - Bash sed -i "/^Target $OCFT_target/,+1d" /etc/ietd.conf
> - AgentRun meta-data OCF_SUCCESS
> diff --git a/tools/ocft/mysql b/tools/ocft/mysql
> index 6cb5dff..f0b475e 100644
> --- a/tools/ocft/mysql
> +++ b/tools/ocft/mysql
> @@ -10,7 +10,7 @@ SETUP-AGENT
> /etc/init.d/mysql stop
>
> CASE-BLOCK crm_setting
> - Var OCF_RESKEY_CRM_meta_timeout=15000
> + Env OCF_RESKEY_CRM_meta_timeout=15000
>
> CASE-BLOCK default_status
> AgentRun stop
> @@ -25,7 +25,7 @@ CASE "check base env"
>
> CASE "check base env: invalid 'OCF_RESKEY_binary'"
> Include prepare
> - Var OCF_RESKEY_binary=no_such
> + Env OCF_RESKEY_binary=no_such
> AgentRun start OCF_ERR_INSTALLED
>
> CASE "normal start"
> @@ -67,10 +67,10 @@ CASE "unimplemented command"
>
> CASE "non-existent user"
> Include prepare
> - Var OCF_RESKEY_user=no_user
> + Env OCF_RESKEY_user=no_user
> AgentRun start OCF_ERR_INSTALLED
>
> CASE "invalid user"
> Include prepare
> - Var OCF_RESKEY_user=nobody
> + Env OCF_RESKEY_user=nobody
> AgentRun start OCF_ERR_PERM
> diff --git a/tools/ocft/named b/tools/ocft/named
> index 7785eba..c1f4624 100644
> --- a/tools/ocft/named
> +++ b/tools/ocft/named
> @@ -11,7 +11,7 @@ SETUP-AGENT
> /etc/init.d/named stop
>
> CASE-BLOCK crm_setting
> - Var OCF_RESKEY_CRM_meta_timeout=15000
> + Env OCF_RESKEY_CRM_meta_timeout=15000
>
> CASE-BLOCK default_status
> AgentRun stop
> @@ -26,7 +26,7 @@ CASE "check base env"
>
> CASE "check base env: invalid 'OCF_RESKEY_named'"
> Include prepare
> - Var OCF_RESKEY_named=no_such
> + Env OCF_RESKEY_named=no_such
> AgentRun start OCF_ERR_INSTALLED
>
> CASE "normal start"
> @@ -62,5 +62,5 @@ CASE "unimplemented command"
>
> CASE "non-existent user"
> Include prepare
> - Var OCF_RESKEY_named_user=no_user
> + Env OCF_RESKEY_named_user=no_user
> AgentRun start OCF_ERR_INSTALLED
> diff --git a/tools/ocft/nfsserver b/tools/ocft/nfsserver
> index bd7d47b..2fa905f 100644
> --- a/tools/ocft/nfsserver
> +++ b/tools/ocft/nfsserver
> @@ -6,10 +6,10 @@ CONFIG
> HangTimeout 20
>
> CASE-BLOCK required_args
> - Var OCF_RESKEY_nfs_init_script=/etc/init.d/nfsserver
> - Var OCF_RESKEY_nfs_ip=127.0.0.1
> - Var OCF_RESKEY_nfs_shared_infodir=/var/lib/nfs
> - Var OCF_RESKEY_nfs_notify_cmd=/usr/sbin/sm-notify
> + Env OCF_RESKEY_nfs_init_script=/etc/init.d/nfsserver
> + Env OCF_RESKEY_nfs_ip=127.0.0.1
> + Env OCF_RESKEY_nfs_shared_infodir=/var/lib/nfs
> + Env OCF_RESKEY_nfs_notify_cmd=/usr/sbin/sm-notify
>
> CASE-BLOCK default_status
> AgentRun stop
> @@ -24,22 +24,22 @@ CASE "check base env"
>
> CASE "check base env: invalid 'OCF_RESKEY_nfs_init_script'"
> Include prepare
> - Var OCF_RESKEY_nfs_init_script=no_such_script
> + Env OCF_RESKEY_nfs_init_script=no_such_script
> AgentRun start OCF_ERR_INSTALLED
>
> CASE "check base env: unset 'OCF_RESKEY_nfs_ip'"
> Include prepare
> - Unvar OCF_RESKEY_nfs_ip
> + Unenv OCF_RESKEY_nfs_ip
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "check base env: unset 'OCF_RESKEY_nfs_shared_infodir'"
> Include prepare
> - Unvar OCF_RESKEY_nfs_shared_infodir
> + Unenv OCF_RESKEY_nfs_shared_infodir
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "check base env: invalid 'OCF_RESKEY_nfs_notify_cmd'"
> Include prepare
> - Var OCF_RESKEY_nfs_notify_cmd=no_such_program
> + Env OCF_RESKEY_nfs_notify_cmd=no_such_program
> AgentRun start OCF_ERR_INSTALLED
>
> CASE "normal start"
> diff --git a/tools/ocft/ocft.in b/tools/ocft/ocft.in
> index c9e788e..c286b52 100644
> --- a/tools/ocft/ocft.in
> +++ b/tools/ocft/ocft.in
> @@ -1,6 +1,6 @@
> #!/bin/bash
>
> -# Copyright (c) 2010 Novell Inc, John Shi
> +# Copyright (c) 2010-2011 Novell Inc, John Shi
> # All Rights Reserved.
> #
> # This program is free software; you can redistribute it and/or modify
> @@ -121,9 +121,6 @@ preparse_cfg()
> die "${agent}: configuration file not found."
> fi
>
> - rm -f $CASES_DIR/${agent}_macro.*
> - rm -f $CASES_DIR/${agent}.preparse
> -
> line_num=0
> while read -r line; do
> let line_num++
> @@ -162,16 +159,11 @@ preparse_cfg()
> esac
>
> if [ -n "$macro" ]; then
> - if ! touch "$macro"; then
> - die "No permission to create macro file: ${macro}."
> - fi
> echo "$line$num" >>"$macro"
> else
> - echo "$line$num" >>"$CASES_DIR/${agent}.preparse"
> + echo "$line$num" >>"$CASES_DIR/${agent}_preparse"
> fi
> done <"$opt_cfgsdir/$agent"
> -
> - rm -f $CASES_DIR/${agent}_macro.*
> }
>
> case_finish()
> @@ -180,21 +172,35 @@ case_finish()
>
> if [ -n "$sh" ]; then
> cat >>$sh <<EOF
> -if [ -n "\$OCFT_VERBOSE" ]; then
> +if [ -n "\$__OCFT__VERBOSE" ]; then
> echo
> fi
> -# Clean up and exit
> +# Cleanup and exit
> EOF
> for host in $hosts; do
> echo "backbash_stop $host" >>$sh
> done
> echo "quit 0" >>$sh
> fi
> +
> atexit_num=0
> hosts=
> sh=
> }
>
> +agent_finish()
> +{
> + rm -f $CASES_DIR/${agent}_preparse
> + rm -f $CASES_DIR/${agent}_macro.*
> + rm -f $CASES_DIR/${agent}_setup
> + rm -f $CASES_DIR/${agent}_cleanup
> + rm -f $CASES_DIR/${agent}_var
> + rm -f $CASES_DIR/${agent}_hosts
> + cfg_agent_root=
> + cfg_install_package=()
> + cfg_hang_timeout=20
> +}
> +
> parse_cfg()
> {
> local agents i line stat sh trunk branch atexit_num host hosts
> @@ -206,10 +212,11 @@ parse_cfg()
> fi
>
> for agent in "${agents[@]}"; do
> + rm -f $CASES_DIR/*_${agent}.sh
> + agent_finish
> +
> i=0
> agent="$(basename "$agent")"
> - rm -f $CASES_DIR/*_${agent}.sh
> - rm -f $CASES_DIR/${agent}_setup
>
> echo "Making '$agent': "
> preparse_cfg "$agent"
> @@ -225,16 +232,26 @@ parse_cfg()
> stat=1
> continue
> ;;
> - SETUP-AGENT)
> + VARIABLE)
> case_finish
> stat=2
> continue
> ;;
> + SETUP-AGENT)
> + case_finish
> + stat=3
> + continue
> + ;;
> + CLEANUP-AGENT)
> + case_finish
> + stat=4
> + continue
> + ;;
> CASE)
> case_finish
> trunk2branch
> - sh="$CASES_DIR/${i}_${agent}.sh"
> echo " - case ${i}: ${branch[0]}"
> + sh="$CASES_DIR/${i}_${agent}.sh"
> cat >$sh <<EOF
> #!/bin/bash
>
> @@ -246,30 +263,22 @@ parse_cfg()
> exit 2
> }
>
> -MYROOT="$cfg_agent_root"
> -EOF
> - if [ -n "$cfg_install_package" ]; then
> - cat >>$sh <<EOF
> -agent_install ${cfg_install_package[@]}
> -EOF
> - fi
> - if [ -r "$CASES_DIR/${agent}_setup" ]; then
> - cat >>$sh <<EOF
> -agent_setup $agent <<'CMD'
> -$(cat "$CASES_DIR/${agent}_setup")
> -CMD
> -EOF
> - fi
> - cat >>$sh <<EOF
> -if [ -n "\$OCFT_VERBOSE" ]; then
> +$(test -r $CASES_DIR/${agent}_var && cat $CASES_DIR/${agent}_var)
> +
> +__OCFT__MYROOT="$cfg_agent_root"
> +
> +$(test -n "$cfg_install_package" && echo "agent_install ${cfg_install_package[@]}")
> +
> +if [ -n "\$__OCFT__VERBOSE" ]; then
> echo -e $(add_quotes 1 "Starting '\\033[33m${agent}\\033[0m' case $i '\\033[33m${branch[0]}\\033[.0m':")
> else
> echo -n "'${agent}' case ${i}: "
> fi
> EOF
> chmod a+x $sh
> +
> let i++
> - stat=3
> + stat=5
> continue
> ;;
> esac
> @@ -283,7 +292,7 @@ EOF
> ;;
> InstallPackage)
> trunk2branch
> - cfg_install_package=("${branch[@]}")
> + cfg_install_package=(${cfg_install_package[@]} ${branch[@]})
> ;;
> HangTimeout)
> trunk2branch
> @@ -298,37 +307,39 @@ EOF
> esac
> ;;
> 2)
> - echo "$line" >>$CASES_DIR/${agent}_setup
> + if echo "$line" | grep -q '^__OCFT__'; then
> + parse_die "reserved key word '__OCFT__'."
> + fi
> + echo "declare $line" >>$CASES_DIR/${agent}_var
> ;;
> 3)
> + echo "$line" >>$CASES_DIR/${agent}_setup
> + ;;
> + 4)
> + echo "$line" >>$CASES_DIR/${agent}_cleanup
> + ;;
> + 5)
> host=$(echo ${trunk[0]} | awk -F@ '{print $2}')
> if [ -n "$host" ]; then
> if ! echo "$hosts" | grep -q "$host"; then
> + echo "$host" >>$CASES_DIR/${agent}_hosts
> hosts=$hosts$'\n'$host
> cat >>$sh <<EOF
> # Initialize remote shell
> backbash_start $host
> backbash $host <<CMD
> -OCFT_VERBOSE=\$OCFT_VERBOSE
> -showhost="${host}: "
> +__OCFT__VERBOSE=\$__OCFT__VERBOSE
> CMD
> backbash $host <$OCFT_DIR/caselib
> backbash $host <<'CMD'
> -MYROOT="$cfg_agent_root"
> -EOF
> - if [ -n "$cfg_install_package" ]; then
> - cat >>$sh <<EOF
> -agent_install ${cfg_install_package[@]}
> -EOF
> - fi
> - if [ -r "$CASES_DIR/${agent}_setup" ]; then
> - cat >>$sh <<EOF
> -agent_setup $agent <<'END'
> -$(cat "$CASES_DIR/${agent}_setup")
> -END
> +__OCFT__showhost="${host}: "
> +__OCFT__MYROOT="$cfg_agent_root"
> +
> +$(test -r $CASES_DIR/${agent}_var && cat $CASES_DIR/${agent}_var)
> +
> +$(test -n "$cfg_install_package" && echo "agent_install ${cfg_install_package[@]}")
> +CMD
> EOF
> - fi
> - echo "CMD" >>$sh
> fi
> fi
>
> @@ -340,19 +351,19 @@ EOF
> fi
>
> case "${trunk[0]}" in
> - Var|Var@*)
> + Env|Env@*)
> cat >>$sh <<EOF
> -if [ -n "\$OCFT_VERBOSE" ]; then
> - echo $(add_quotes 2 " \${showhost}Setting agent environment: export ${trunk[1]}")
> +if [ -n "\$__OCFT__VERBOSE" ]; then
> + echo $(add_quotes 2 " \${__OCFT__showhost}Setting agent environment: export ${trunk[1]}")
> fi
> export ${trunk[1]}
> check_success \$? $(add_quotes 1 "export ${trunk[1]}")
> EOF
> ;;
> - Unvar|Unvar@*)
> + Unenv|Unenv@*)
> cat >>$sh <<EOF
> -if [ -n "\$OCFT_VERBOSE" ]; then
> - echo $(add_quotes 2 " \${showhost}Removing agent environment: unset ${trunk[1]}")
> +if [ -n "\$__OCFT__VERBOSE" ]; then
> + echo $(add_quotes 2 " \${__OCFT__showhost}Removing agent environment: unset ${trunk[1]}")
> fi
> unset ${trunk[1]}
> check_success \$? $(add_quotes 1 "unset ${trunk[1]}")
> @@ -364,43 +375,43 @@ EOF
> if [ "${branch[0]}" = "start" ]; then
> cat >>$sh <<EOF
> agent_run $(add_quotes 1 "$agent") status $cfg_hang_timeout
> -rc=\$?
> -if [ \$rc -eq \$OCF_ERR_UNIMPLEMENTED ]; then
> +__OCFT__rc=\$?
> +if [ \$__OCFT__rc -eq \$OCF_ERR_UNIMPLEMENTED ]; then
> agent_run $(add_quotes 1 "$agent") monitor $cfg_hang_timeout
> - rc=\$?
> + __OCFT__rc=\$?
> fi
>
> -if [ \$rc -eq \$OCF_SUCCESS ]; then
> +if [ \$__OCFT__rc -eq \$OCF_SUCCESS ]; then
> : #The status I want, so I can do nothing.
> -elif [ \$rc -eq \$OCF_NOT_RUNNING ]; then
> - if [ -n "\$OCFT_VERBOSE" ]; then
> - echo $(add_quotes 2 " \${showhost}Running agent: ./$agent start")
> +elif [ \$__OCFT__rc -eq \$OCF_NOT_RUNNING ]; then
> + if [ -n "\$__OCFT__VERBOSE" ]; then
> + echo $(add_quotes 2 " \${__OCFT__showhost}Running agent: ./$agent start")
> fi
> agent_run $(add_quotes 1 "$agent") start $cfg_hang_timeout
> check_success \$? $(add_quotes 1 "./$agent start")
> else
> - check_success \$rc $(add_quotes 1 "./$agent status|monitor")
> + check_success \$__OCFT__rc $(add_quotes 1 "./$agent status|monitor")
> fi
> EOF
> elif [ "${branch[0]}" = "stop" ]; then
> cat >>$sh <<EOF
> agent_run $(add_quotes 1 "$agent") status $cfg_hang_timeout
> -rc=\$?
> -if [ \$rc -eq \$OCF_ERR_UNIMPLEMENTED ]; then
> +__OCFT__rc=\$?
> +if [ \$__OCFT__rc -eq \$OCF_ERR_UNIMPLEMENTED ]; then
> agent_run $(add_quotes 1 "$agent") monitor $cfg_hang_timeout
> - rc=\$?
> + __OCFT__rc=\$?
> fi
>
> -if [ \$rc -eq \$OCF_NOT_RUNNING ]; then
> +if [ \$__OCFT__rc -eq \$OCF_NOT_RUNNING ]; then
> : #The status I want, so I can do nothing.
> -elif [ \$rc -eq \$OCF_SUCCESS ]; then
> - if [ -n "\$OCFT_VERBOSE" ]; then
> - echo $(add_quotes 2 " \${showhost}Running agent: ./$agent stop")
> +elif [ \$__OCFT__rc -eq \$OCF_SUCCESS ]; then
> + if [ -n "\$__OCFT__VERBOSE" ]; then
> + echo $(add_quotes 2 " \${__OCFT__showhost}Running agent: ./$agent stop")
> fi
> agent_run $(add_quotes 1 "$agent") stop $cfg_hang_timeout
> check_success \$? $(add_quotes 1 "./$agent stop")
> else
> - check_success \$rc $(add_quotes 1 "./$agent status|monitor")
> + check_success \$__OCFT__rc $(add_quotes 1 "./$agent status|monitor")
> fi
> EOF
> elif [ "${branch[0]}" = "status" -o "${branch[0]}" = "monitor" ]; then
> @@ -417,30 +428,30 @@ EOF
> cat >>$sh <<EOF
> test -n $(add_quotes 2 "\$${branch[1]}")
> check_success \$? $(add_quotes 1 "test -n \"\$${branch[1]}\"")
> -if [ -n "\$OCFT_VERBOSE" ]; then
> - echo $(add_quotes 2 " \${showhost}Running agent: ./$agent ${branch[0]}")
> +if [ -n "\$__OCFT__VERBOSE" ]; then
> + echo $(add_quotes 2 " \${__OCFT__showhost}Running agent: ./$agent ${branch[0]}")
> fi
> agent_run $(add_quotes 1 "$agent") $(add_quotes 1 "${branch[0]}") $cfg_hang_timeout
> -ret=\$?
> -if [ -n "\$OCFT_VERBOSE" ]; then
> - echo -n " \${showhost}Checking return value:"
> +__OCFT__ret=\$?
> +if [ -n "\$__OCFT__VERBOSE" ]; then
> + echo -n " \${__OCFT__showhost}Checking return value:"
> fi
> -if [ -n "\${retval[ret]}" ]; then
> - retstr="\${retval[ret]}"
> +if [ -n "\${__OCFT__retval[__OCFT__ret]}" ]; then
> + __OCFT__retstr="\${__OCFT__retval[__OCFT__ret]}"
> else
> - retstr=\$ret
> + __OCFT__retstr=\$__OCFT__ret
> fi
> -if [ \$ret -eq \$${branch[1]} ]; then
> - if [ -n "\$OCFT_VERBOSE" ]; then
> - echo -e $(add_quotes 2 " \\033[32mOK\\033[0m. The return value '\\033[34m\$retstr\\033[0m' == '\\033[34m${branch[1]}\\033[0m'")
> +if [ \$__OCFT__ret -eq \$${branch[1]} ]; then
> + if [ -n "\$__OCFT__VERBOSE" ]; then
> + echo -e $(add_quotes 2 " \\033[32mOK\\033[0m. The return value '\\033[34m\$__OCFT__retstr\\033[0m' == '\\033[34m${branch[1]}\\033[.0m'")
> else
> echo -e "\t\\033[.32mOK\\033[.0m."
> fi
> else
> - if [ -n "\$OCFT_VERBOSE" ]; then
> - echo -en $(add_quotes 2 " \\033[31mFAILED\\033[0m. The return value '\\033[34m\$retstr\\033[0m' != '\\033[34m${branch[1]}\\033[0m'. ")
> + if [ -n "\$__OCFT__VERBOSE" ]; then
> + echo -en $(add_quotes 2 " \\033[31mFAILED\\033[0m. The return value '\\033[34m\$__OCFT__retstr\\033[0m' != '\\033[34m${branch[1]}\\033[.0m'. ")
> else
> - echo -en "\t\\033[.31mFAILED\\033[.0m. Agent returns unexpected value: '\$retstr'. "
> + echo -en "\t\\033[.31mFAILED\\033[.0m. Agent returns unexpected value: '\$__OCFT__retstr'. "
> fi
> echo "See details below:"
> cat /tmp/.ocft_runlog
> @@ -452,10 +463,10 @@ EOF
> ;;
> Bash|Bash@*)
> cat >>$sh <<EOF
> -if [ -n "\$OCFT_VERBOSE" ]; then
> - echo $(add_quotes 2 " \${showhost}Setting system environment: ${trunk[1]}")
> +if [ -n "\$__OCFT__VERBOSE" ]; then
> + echo $(add_quotes 2 " \${__OCFT__showhost}Setting system environment: ${trunk[1]}")
> fi
> -echo $(add_quotes 1 "${trunk[1]}") | /bin/bash
> +${trunk[1]}
> check_success \$? $(add_quotes 1 "${trunk[1]}")
> EOF
> ;;
> @@ -464,12 +475,12 @@ EOF
> cat >>$sh <<EOF
> atexit${atexit_num}()
> {
> - if [ -n "\$OCFT_VERBOSE" ]; then
> - echo $(add_quotes 2 " \${showhost}Setting system environment: ${trunk[1]}")
> + if [ -n "\$__OCFT__VERBOSE" ]; then
> + echo $(add_quotes 2 " \${__OCFT__showhost}Setting system environment: ${trunk[1]}")
> fi
> - echo $(add_quotes 1 "${trunk[1]}") | /bin/bash
> + ${trunk[1]}
> }
> -let atexit_num++
> +let __OCFT__atexit_num++
> EOF
> ;;
> *)
> @@ -484,22 +495,120 @@ EOF
> parse_die "unimplemented statement: ${trunk[0]}"
> ;;
> esac
> - done <$CASES_DIR/${agent}.preparse
> - rm -f $CASES_DIR/${agent}.preparse
> - rm -f $CASES_DIR/${agent}_setup
> + done <$CASES_DIR/${agent}_preparse
> +
> + if [ -r "$CASES_DIR/${agent}_setup" ]; then
> + cat >$CASES_DIR/setup_${agent}.sh <<EOF
> +#!/bin/bash
> +
> +# Agent: $agent
> +# Summary: SETUP before test
> +
> +echo "Initializing '$agent' ..."
> +
> +. $OCFT_DIR/caselib || {
> + echo "ERROR: '$OCFT_DIR/caselib' not found."
> + exit 2
> +}
> +
> +$(test -r "$CASES_DIR/${agent}_var" && cat $CASES_DIR/${agent}_var)
> +$(test -n "$cfg_install_package" && echo "agent_install ${cfg_install_package[@]}")
> +
> +$(cat $CASES_DIR/${agent}_setup)
> +check_success \$? "SETUP-AGENT"
> +
> +EOF
> + for host in $(test -r $CASES_DIR/${agent}_hosts && cat $CASES_DIR/${agent}_hosts); do
> + cat >>$CASES_DIR/setup_${agent}.sh <<EOF
> +# Initialize remote shell
> +backbash_start $host
> +backbash $host <<CMD
> +__OCFT__VERBOSE=\$__OCFT__VERBOSE
> +CMD
> +backbash $host <$OCFT_DIR/caselib
> +backbash $host <<'CMD'
> +__OCFT__MYROOT="$cfg_agent_root"
> +__OCFT__showhost="${host}: "
> +$(test -r "$CASES_DIR/${agent}_var" && cat $CASES_DIR/${agent}_var)
> +$(test -n "$cfg_install_package" && echo "agent_install ${cfg_install_package[@]}")
> +
> +$(cat $CASES_DIR/${agent}_setup)
> +check_success \$? "SETUP-AGENT"
> +CMD
> +backbash_stop $host
> +EOF
> + done
> + cat >>$CASES_DIR/setup_${agent}.sh <<EOF
> +echo "Done."
> +echo
> +quit 0
> +EOF
> + chmod a+x $CASES_DIR/setup_${agent}.sh
> + fi
> +
> + if [ -r "$CASES_DIR/${agent}_cleanup" ]; then
> + cat >$CASES_DIR/cleanup_${agent}.sh <<EOF
> +#!/bin/bash
> +
> +# Agent: $agent
> +# Summary: CLEANUP after test
> +
> +echo "Cleaning '$agent' ..."
> +
> +. $OCFT_DIR/caselib || {
> + echo "ERROR: '$OCFT_DIR/caselib' not found."
> + exit 2
> +}
> +
> +$(test -r "$CASES_DIR/${agent}_var" && cat $CASES_DIR/${agent}_var)
> +$(test -n "$cfg_install_package" && echo "agent_install ${cfg_install_package[@]}")
> +
> +$(cat $CASES_DIR/${agent}_cleanup)
> +check_success \$? "CLEANUP-AGENT"
> +
> +EOF
> + for host in $(test -r $CASES_DIR/${agent}_hosts && cat $CASES_DIR/${agent}_hosts); do
> + cat >>$CASES_DIR/cleanup_${agent}.sh <<EOF
> +# Initialize remote shell
> +backbash_start $host
> +backbash $host <<CMD
> +__OCFT__VERBOSE=\$__OCFT__VERBOSE
> +CMD
> +backbash $host <$OCFT_DIR/caselib
> +backbash $host <<'CMD'
> +__OCFT__MYROOT="$cfg_agent_root"
> +__OCFT__showhost="${host}: "
> +$(test -r "$CASES_DIR/${agent}_var" && cat $CASES_DIR/${agent}_var)
> +$(test -n "$cfg_install_package" && echo "agent_install ${cfg_install_package[@]}")
> +
> +$(cat $CASES_DIR/${agent}_cleanup)
> +check_success \$? "CLEANUP-AGENT"
> +CMD
> +backbash_stop $host
> +EOF
> + done
> + cat >>$CASES_DIR/cleanup_${agent}.sh <<EOF
> +echo "Done."
> +echo
> +quit 0
> +EOF
> + chmod a+x $CASES_DIR/cleanup_${agent}.sh
> + fi
> case_finish
> + agent_finish
> +
> done
> }
>
> start_test()
> {
> - local sh shs agents line ret
> + local sh shs testsh agents line ret
>
> if ! cd $CASES_DIR >/dev/null 2>&1; then
> die "cases directory not found."
> fi
>
> - export OCFT_VERBOSE=$opt_verbose
> + export __OCFT__VERBOSE=$opt_verbose
>
> if [ $# -eq 0 ]; then
> agents=($(ls -1 *.sh 2>/dev/null | sed 's/.*_\([^_]*\)\.sh$/\1/' | sort | uniq))
> @@ -508,18 +617,23 @@ start_test()
> fi
>
> for shs in "${agents[@]}"; do
> - for sh in $(ls -1 *_${shs}.sh 2>/dev/null | sort -n); do
> - ./$sh
> - ret=$?
> - if [ $ret -eq 3 ]; then
> - die "core function failed, break all tests."
> - fi
> - if [ $ret -eq 2 ]; then
> - warn "core function failed, break all tests of '$shs'."
> - break
> + testsh="setup_${shs}.sh
> +$(ls -1 [0-9]*_${shs}.sh 2>/dev/null | sort -n)
> +cleanup_${shs}.sh"
> + for sh in $testsh; do
> + if [ -r "$sh" ]; then
> + ./$sh
> + ret=$?
> + if [ $ret -eq 3 ]; then
> + die "core function failed, break all tests."
> + fi
> + if [ $ret -eq 2 ]; then
> + warn "core function failed, break all tests of '$shs'."
> + break
> + fi
> fi
> done
> - done | while read -r line; do
> + done 2>&1 | while read -r line; do
> echo "$line"
> echo "$(date '+%F %T'): $line" | cat -A |
> sed -r 's/\^\[\[[0-9]+m|\^I|.$//g' >>ocft.log
> @@ -552,7 +666,7 @@ ACTIONs include:
> clean Delete the testing shell scripts.
> help [-v] Show this help and exit.
> -v Show HOWTO and exit.
> -Version 0.42
> +Version 0.43
> See '$OCFT_DIR/README' for detail.
> EOF
> }
> @@ -571,7 +685,7 @@ HOW TO USE THIS TOOL
> Hence it is useful to debuggers.
>
> * Components
> - ** Test case generator (@sbindir@/ocft)
> + ** Test case generator (/usr/sbin/ocft)
> - Turning configuration files of test case to executable scripts.
>
> ** Configuration file ($CONFIGS_DIR/)
> @@ -616,7 +730,7 @@ line_num=
>
> # default configuration
> cfg_agent_root=
> -cfg_install_package=
> +cfg_install_package=()
> cfg_hang_timeout=20
>
> # default option
> diff --git a/tools/ocft/pgsql b/tools/ocft/pgsql
> index 7bcfda4..859b82e 100644
> --- a/tools/ocft/pgsql
> +++ b/tools/ocft/pgsql
> @@ -10,7 +10,7 @@ SETUP-AGENT
> /etc/init.d/postgresql stop
>
> CASE-BLOCK crm_setting
> - Var OCF_RESKEY_CRM_meta_timeout=15000
> + Env OCF_RESKEY_CRM_meta_timeout=15000
>
> CASE-BLOCK default_status
> AgentRun stop
> @@ -25,7 +25,7 @@ CASE "check base env"
>
> CASE "check base env: invalid 'OCF_RESKEY_pgctl'"
> Include prepare
> - Var OCF_RESKEY_pgctl=no_such
> + Env OCF_RESKEY_pgctl=no_such
> AgentRun start OCF_ERR_INSTALLED
>
> CASE "normal start"
> @@ -61,10 +61,10 @@ CASE "unimplemented command"
>
> CASE "non-existent user"
> Include prepare
> - Var OCF_RESKEY_pgdba=no_user
> + Env OCF_RESKEY_pgdba=no_user
> AgentRun start OCF_ERR_INSTALLED
>
> CASE "invalid user"
> Include prepare
> - Var OCF_RESKEY_pgdba=nobody
> + Env OCF_RESKEY_pgdba=nobody
> AgentRun start OCF_ERR_PERM
> diff --git a/tools/ocft/portblock b/tools/ocft/portblock
> index b10046b..57794fe 100644
> --- a/tools/ocft/portblock
> +++ b/tools/ocft/portblock
> @@ -6,9 +6,9 @@ CONFIG
> HangTimeout 15
>
> CASE-BLOCK required_args
> - Var OCF_RESKEY_protocol=tcp
> - Var OCF_RESKEY_portno=80
> - Var OCF_RESKEY_action=block
> + Env OCF_RESKEY_protocol=tcp
> + Env OCF_RESKEY_portno=80
> + Env OCF_RESKEY_action=block
>
> CASE-BLOCK default_status
> AgentRun stop
> @@ -23,17 +23,17 @@ CASE "check base env"
>
> CASE "check base env: unset 'OCF_RESKEY_protocol'"
> Include prepare
> - Unvar OCF_RESKEY_protocol
> + Unenv OCF_RESKEY_protocol
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "check base env: unset 'OCF_RESKEY_portno'"
> Include prepare
> - Unvar OCF_RESKEY_portno
> + Unenv OCF_RESKEY_portno
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "check base env: unset 'OCF_RESKEY_action'"
> Include prepare
> - Unvar OCF_RESKEY_action
> + Unenv OCF_RESKEY_action
> AgentRun start OCF_ERR_CONFIGURED
>
> CASE "normal start"
> diff --git a/tools/ocft/postfix b/tools/ocft/postfix
> index 0167bb4..2d897c9 100644
> --- a/tools/ocft/postfix
> +++ b/tools/ocft/postfix
> @@ -20,8 +20,8 @@ SETUP-AGENT
> # nothing
>
> CASE-BLOCK crm_setting
> - Var OCF_RESKEY_CRM_meta_timeout=15000
> - Var OCF_RESKEY_CRM_meta_interval=10000
> + Env OCF_RESKEY_CRM_meta_timeout=15000
> + Env OCF_RESKEY_CRM_meta_interval=10000
>
> CASE-BLOCK default_status
> AgentRun stop
> @@ -36,29 +36,29 @@ CASE "check base env"
>
> CASE "check base env: invalid 'OCF_RESKEY_binary'"
> Include prepare
> - Var OCF_RESKEY_binary=no_such
> + Env OCF_RESKEY_binary=no_such
> AgentRun start OCF_ERR_INSTALLED
>
> CASE "check base env: invalid 'OCF_RESKEY_config_dir'"
> Include prepare
> - Var OCF_RESKEY_config_dir=no_such
> + Env OCF_RESKEY_config_dir=no_such
> AgentRun start OCF_ERR_INSTALLED
>
> CASE "check base env: 'OCF_RESKEY_binary'"
> Include prepare
> - Var OCF_RESKEY_binary=/usr/sbin/postfix
> + Env OCF_RESKEY_binary=/usr/sbin/postfix
> AgentRun start
> AgentRun monitor OCF_SUCCESS
>
> CASE "check base env: 'OCF_RESKEY_config_dir' without trailing slash"
> Include prepare
> - Var OCF_RESKEY_config_dir="/etc/postfix"
> + Env OCF_RESKEY_config_dir="/etc/postfix"
> AgentRun start
> AgentRun monitor OCF_SUCCESS
>
> CASE "check base env: 'OCF_RESKEY_config_dir' with trailing slash"
> Include prepare
> - Var OCF_RESKEY_config_dir="/etc/postfix/"
> + Env OCF_RESKEY_config_dir="/etc/postfix/"
> AgentRun start
> AgentRun monitor OCF_SUCCESS
>
> @@ -87,12 +87,12 @@ CASE "monitor a running resource"
>
> CASE "(initial) probe a stopped resource"
> Include prepare
> - Var OCF_RESKEY_CRM_meta_interval=0
> + Env OCF_RESKEY_CRM_meta_interval=0
> AgentRun monitor OCF_NOT_RUNNING
>
> CASE "(re-)probe a running resource"
> Include prepare
> - Var OCF_RESKEY_CRM_meta_interval=0
> + Env OCF_RESKEY_CRM_meta_interval=0
> AgentRun start
> AgentRun monitor OCF_SUCCESS
>
> --
> 1.6.4.2
>

_______________________________________________
ha-wg-technical mailing list
ha-wg-technical [at] lists
https://lists.linuxfoundation.org/mailman/listinfo/ha-wg-technical

Linux-HA ha-wg-technical RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.