Signed-off-by: Zhang Dewan 513619464@qq.com --- jobs/reset-tbox.yaml | 10 ++++++++ tests/reset-tbox | 54 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 jobs/reset-tbox.yaml create mode 100755 tests/reset-tbox
diff --git a/jobs/reset-tbox.yaml b/jobs/reset-tbox.yaml new file mode 100644 index 00000000..4d43850f --- /dev/null +++ b/jobs/reset-tbox.yaml @@ -0,0 +1,10 @@ +suite: reset-tbox +category: functional + +testbox: dc-8g +os_mount: container +docker_image: 172.168.131.2:5001/reset-tbox +queue: reset-tbox + +reset-tbox: + host_name: diff --git a/tests/reset-tbox b/tests/reset-tbox new file mode 100755 index 00000000..1ca17bfd --- /dev/null +++ b/tests/reset-tbox @@ -0,0 +1,54 @@ +#!/bin/bash +# host_nameset + +account_file=/etc/lab/.account.info +hosts_file=/etc/lab/hosts_file +command_file=/usr/bin/ipmitool + +FileCheck() +{ + for i in $account_file $hosts_file $command_file + do + [ -f $i ] || { + echo "File not found: $i" + exit 0 + } + done + source $account_file +} + +TboxCheck() +{ + ibmc_ip=$(grep -w $host_name $hosts_file | awk '{print $1}') + + [[ "$ibmc_ip" =~ ^[0-9]+.* ]] || { + echo "Testbox not found: $host_name" + exit 1 + } +} + +ResetTbox() +{ + echo "reboot the tesetbox..." + ipmitool -I lanplus -H $ibmc_ip -U $iBMC_user -P $iBMC_passwd power reset +} + +ResultCheck() +{ + if [ $? -ne 0 ] ; then + echo "Failed to reboot the testbox: $host_name" + fi + echo "done." +} + +main() +{ + FileCheck + TboxCheck + ResetTbox + ResultCheck +} +main + + +
On Wed, Jan 20, 2021 at 11:51:30AM +0800, Zhang Dewan wrote:
Signed-off-by: Zhang Dewan 513619464@qq.com
jobs/reset-tbox.yaml | 10 ++++++++ tests/reset-tbox | 54 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 jobs/reset-tbox.yaml create mode 100755 tests/reset-tbox
diff --git a/jobs/reset-tbox.yaml b/jobs/reset-tbox.yaml new file mode 100644 index 00000000..4d43850f --- /dev/null +++ b/jobs/reset-tbox.yaml @@ -0,0 +1,10 @@ +suite: reset-tbox +category: functional
+testbox: dc-8g +os_mount: container +docker_image: 172.168.131.2:5001/reset-tbox
pls remove ip port we have docker-pull
xsw@crystal ~/compass-ci/providers% which docker-pull /home/xsw/compass-ci/sbin/docker-pull
+queue: reset-tbox
+reset-tbox:
host_name:
diff --git a/tests/reset-tbox b/tests/reset-tbox new file mode 100755 index 00000000..1ca17bfd --- /dev/null +++ b/tests/reset-tbox @@ -0,0 +1,54 @@ +#!/bin/bash +# host_nameset
+account_file=/etc/lab/.account.info +hosts_file=/etc/lab/hosts_file +command_file=/usr/bin/ipmitool
command -v ipmitool
Thanks, Shenwei
+FileCheck() +{
- for i in $account_file $hosts_file $command_file
- do
[ -f $i ] || {
echo "File not found: $i"
exit 0
}
- done
- source $account_file
+}
+TboxCheck() +{
- ibmc_ip=$(grep -w $host_name $hosts_file | awk '{print $1}')
- [[ "$ibmc_ip" =~ ^[0-9]+.* ]] || {
echo "Testbox not found: $host_name"
exit 1
- }
+}
+ResetTbox() +{
- echo "reboot the tesetbox..."
- ipmitool -I lanplus -H $ibmc_ip -U $iBMC_user -P $iBMC_passwd power reset
+}
+ResultCheck() +{
- if [ $? -ne 0 ] ; then
echo "Failed to reboot the testbox: $host_name"
- fi
- echo "done."
+}
+main() +{
- FileCheck
- TboxCheck
- ResetTbox
- ResultCheck
+} +main
-- 2.23.0
On Wed, Jan 20, 2021 at 11:58:58AM +0800, Xiao Shenwei wrote:
On Wed, Jan 20, 2021 at 11:51:30AM +0800, Zhang Dewan wrote:
Signed-off-by: Zhang Dewan 513619464@qq.com
jobs/reset-tbox.yaml | 10 ++++++++ tests/reset-tbox | 54 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 jobs/reset-tbox.yaml create mode 100755 tests/reset-tbox
diff --git a/jobs/reset-tbox.yaml b/jobs/reset-tbox.yaml new file mode 100644 index 00000000..4d43850f --- /dev/null +++ b/jobs/reset-tbox.yaml @@ -0,0 +1,10 @@ +suite: reset-tbox +category: functional
+testbox: dc-8g +os_mount: container +docker_image: 172.168.131.2:5001/reset-tbox
pls remove ip port we have docker-pull
xsw@crystal ~/compass-ci/providers% which docker-pull /home/xsw/compass-ci/sbin/docker-pull
ok, you are right!
Thanks, Dewan
+queue: reset-tbox
+reset-tbox:
host_name:
diff --git a/tests/reset-tbox b/tests/reset-tbox new file mode 100755 index 00000000..1ca17bfd --- /dev/null +++ b/tests/reset-tbox @@ -0,0 +1,54 @@ +#!/bin/bash +# host_nameset
+account_file=/etc/lab/.account.info +hosts_file=/etc/lab/hosts_file +command_file=/usr/bin/ipmitool
command -v ipmitool
Thanks, Shenwei
+FileCheck() +{
- for i in $account_file $hosts_file $command_file
- do
[ -f $i ] || {
echo "File not found: $i"
exit 0
}
- done
- source $account_file
+}
+TboxCheck() +{
- ibmc_ip=$(grep -w $host_name $hosts_file | awk '{print $1}')
- [[ "$ibmc_ip" =~ ^[0-9]+.* ]] || {
echo "Testbox not found: $host_name"
exit 1
- }
+}
+ResetTbox() +{
- echo "reboot the tesetbox..."
- ipmitool -I lanplus -H $ibmc_ip -U $iBMC_user -P $iBMC_passwd power reset
+}
+ResultCheck() +{
- if [ $? -ne 0 ] ; then
echo "Failed to reboot the testbox: $host_name"
- fi
- echo "done."
+}
+main() +{
- FileCheck
- TboxCheck
- ResetTbox
- ResultCheck
+} +main
-- 2.23.0
On Wed, Jan 20, 2021 at 11:51:30AM +0800, Zhang Dewan wrote:
Signed-off-by: Zhang Dewan 513619464@qq.com
jobs/reset-tbox.yaml | 10 ++++++++ tests/reset-tbox | 54 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 jobs/reset-tbox.yaml create mode 100755 tests/reset-tbox
diff --git a/jobs/reset-tbox.yaml b/jobs/reset-tbox.yaml new file mode 100644 index 00000000..4d43850f --- /dev/null +++ b/jobs/reset-tbox.yaml @@ -0,0 +1,10 @@ +suite: reset-tbox +category: functional
+testbox: dc-8g +os_mount: container +docker_image: 172.168.131.2:5001/reset-tbox +queue: reset-tbox
+reset-tbox:
host_name:
diff --git a/tests/reset-tbox b/tests/reset-tbox new file mode 100755 index 00000000..1ca17bfd --- /dev/null +++ b/tests/reset-tbox @@ -0,0 +1,54 @@ +#!/bin/bash +# host_nameset
+account_file=/etc/lab/.account.info +hosts_file=/etc/lab/hosts_file +command_file=/usr/bin/ipmitool
+FileCheck()
please use lowercase letter start and underline.
FileCheck => check_file
+{
- for i in $account_file $hosts_file $command_file
- do
[ -f $i ] || {
echo "File not found: $i"
exit 0
}
- done
- source $account_file
+}
+TboxCheck()
ditto.
+{
- ibmc_ip=$(grep -w $host_name $hosts_file | awk '{print $1}')
- [[ "$ibmc_ip" =~ ^[0-9]+.* ]] || {
echo "Testbox not found: $host_name"
exit 1
- }
+}
+ResetTbox()
ditto.
+{
- echo "reboot the tesetbox..."
- ipmitool -I lanplus -H $ibmc_ip -U $iBMC_user -P $iBMC_passwd power reset
+}
+ResultCheck()
ditto.
+{
- if [ $? -ne 0 ] ; then
echo "Failed to reboot the testbox: $host_name"
- fi
- echo "done."
+}
+main() +{
- FileCheck
- TboxCheck
- ResetTbox
- ResultCheck
+} +main
remove extra three blank line. Thanks, Liushaofei
-- 2.23.0
On Wed, Jan 20, 2021 at 02:28:03PM +0800, Liu Shaofei wrote:
On Wed, Jan 20, 2021 at 11:51:30AM +0800, Zhang Dewan wrote:
Signed-off-by: Zhang Dewan 513619464@qq.com
jobs/reset-tbox.yaml | 10 ++++++++ tests/reset-tbox | 54 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 jobs/reset-tbox.yaml create mode 100755 tests/reset-tbox
diff --git a/jobs/reset-tbox.yaml b/jobs/reset-tbox.yaml new file mode 100644 index 00000000..4d43850f --- /dev/null +++ b/jobs/reset-tbox.yaml @@ -0,0 +1,10 @@ +suite: reset-tbox +category: functional
+testbox: dc-8g +os_mount: container +docker_image: 172.168.131.2:5001/reset-tbox +queue: reset-tbox
+reset-tbox:
host_name:
diff --git a/tests/reset-tbox b/tests/reset-tbox new file mode 100755 index 00000000..1ca17bfd --- /dev/null +++ b/tests/reset-tbox @@ -0,0 +1,54 @@ +#!/bin/bash +# host_nameset
+account_file=/etc/lab/.account.info +hosts_file=/etc/lab/hosts_file +command_file=/usr/bin/ipmitool
+FileCheck()
please use lowercase letter start and underline.
FileCheck => check_file
In this way, the function are same as variables. so why?
Thanks, Dewan
+{
- for i in $account_file $hosts_file $command_file
- do
[ -f $i ] || {
echo "File not found: $i"
exit 0
}
- done
- source $account_file
+}
+TboxCheck()
ditto.
+{
- ibmc_ip=$(grep -w $host_name $hosts_file | awk '{print $1}')
- [[ "$ibmc_ip" =~ ^[0-9]+.* ]] || {
echo "Testbox not found: $host_name"
exit 1
- }
+}
+ResetTbox()
ditto.
+{
- echo "reboot the tesetbox..."
- ipmitool -I lanplus -H $ibmc_ip -U $iBMC_user -P $iBMC_passwd power reset
+}
+ResultCheck()
ditto.
+{
- if [ $? -ne 0 ] ; then
echo "Failed to reboot the testbox: $host_name"
- fi
- echo "done."
+}
+main() +{
- FileCheck
- TboxCheck
- ResetTbox
- ResultCheck
+} +main
remove extra three blank line. Thanks, Liushaofei
-- 2.23.0