From 380beadb379e784bb4d63fe6baca84275b00bdc1 Mon Sep 17 00:00:00 2001 From: yangsbj Date: Thu, 24 May 2018 02:50:11 -0400 Subject: [PATCH 1/2] add test cases for xcat-inventory import -d for osimage inventory directory --- .../cases.osimage.import_from_osimage_dir | 124 ++++++++++++++++++ .../templates/cluster_invdir/cluster.json | 1 + .../osimage/test_myimage/definition.json | 21 +++ .../osimage/test_myimage/test_myimage.stanza | 13 ++ .../test_myimage/tmp/test_myimage/exlist | 1 + .../tmp/test_myimage/otherpkglist | 1 + .../tmp/test_myimage/partitionfile | 1 + .../test_myimage/tmp/test_myimage/postinstall | 1 + .../test_myimage/tmp/test_myimage/synclists | 1 + .../osimage/test_myimage2/definition.json | 21 +++ .../test_myimage2/test_myimage2.stanza | 13 ++ .../test_myimage2/tmp/test_myimage2/exlist | 1 + .../tmp/test_myimage2/otherpkglist | 1 + .../tmp/test_myimage2/partitionfile | 1 + .../tmp/test_myimage2/postinstall | 1 + .../test_myimage2/tmp/test_myimage2/synclists | 1 + 16 files changed, 203 insertions(+) create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/cluster.json create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/definition.json create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/exlist create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/otherpkglist create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/partitionfile create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/postinstall create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/synclists create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/definition.json create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/test_myimage2.stanza create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/exlist create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/otherpkglist create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/partitionfile create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/postinstall create mode 100644 xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/synclists diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir new file mode 100644 index 000000000..a628974f9 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir @@ -0,0 +1,124 @@ +start:export_import_an_osimage_directory +description: import an osimage diretory with `xcat-inventroy import -d ` +#backup any existing test_myimage +cmd:mkdir -p /tmp/export_import_an_osimage_directory/backup +check:rc==0 +cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/export_import_an_osimage_directory/backup/test_myimage.stanza;fi + +#remove any existing test_myimage +cmd:rmdef -t osimage -o test_myimage +cmd: lsdef -t osimage -o test_myimage +check:rc!=0 +cmd: rm -rf /tmp/test_myimage + +#import test_myimage +cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage +check:rc==0 + +#check whether the osimage definition is created +cmd: lsdef -t osimage -o test_myimage -z |tee /tmp/export_import_an_osimage_directory/test_myimage.stanza +check:rc==0 +cmd: diff /tmp/export_import_an_osimage_directory/test_myimage.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza +check: rc==0 +#check whether the customized osimage files are imported +cmd: diff -r /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/ /tmp/test_myimage/ +check:rc==0 + +#cleanup +cmd:rmdef -t osimage -o test_myimage +cmd:rm -rf /tmp/test_myimage + +#restore the original test_myimage if any +#cmd: [ -e '/tmp/export_import_an_osimage_directory/backup/test_myimage.stanza' ] && cat /tmp/export_import_an_osimage_directory/backup/test_myimage.stanza|mkdef -z +cmd: rm -rf /tmp/export_import_an_osimage_directory +end + + +################################################################################# + +start:export_import_multiple_osimages_from_osimage_directory +description: import multiple osimage diretories with `xcat-inventroy import -d ` +#backup any existing test_myimage,test_myimage2 +cmd:mkdir -p /tmp/export_import_multiple_osimages_from_osimage_directory/backup +check:rc==0 +cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage.stanza;fi +cmd:lsdef -t osimage -o test_myimage2 >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage2 -z >/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage2.stanza;fi + +#remove any existing test_myimage,test_myimage2 +cmd:rmdef -t osimage -o test_myimage,test_myimage2 +cmd: lsdef -t osimage -o test_myimage +check:rc!=0 +cmd: lsdef -t osimage -o test_myimage2 +check:rc!=0 +cmd: rm -rf /tmp/test_myimage +cmd: rm -rf /tmp/test_myimage2 + +#import osimages +cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/ +check:rc==0 + +#check whether the osimage definition is created +cmd: lsdef -t osimage -o test_myimage -z | tee /tmp/export_import_multiple_osimages_from_osimage_directory/test_myimage.stanza +check:rc==0 +cmd: lsdef -t osimage -o test_myimage2 -z | tee /tmp/export_import_multiple_osimages_from_osimage_directory/test_myimage2.stanza +check:rc==0 +cmd: diff /tmp/export_import_multiple_osimages_from_osimage_directory/test_myimage.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza +check: rc==0 +cmd: diff /tmp/export_import_multiple_osimages_from_osimage_directory/test_myimage2.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/test_myimage2.stanza +check: rc==0 +#check whether the customized osimage files are imported +cmd: diff -r /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/ /tmp/test_myimage/ +check:rc==0 +cmd: diff -r /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/ /tmp/test_myimage2/ +check:rc==0 + +#cleanup +cmd:rmdef -t osimage -o test_myimage +cmd:rm -rf /tmp/test_myimage +cmd:rmdef -t osimage -o test_myimage2 +cmd:rm -rf /tmp/test_myimage2 + +#restore the original osimages if any +cmd: if [ -e '/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage.stanza' ]; then cat /tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage.stanza|mkdef -z;fi + +cmd: if [ -e '/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage2.stanza' ]; then cat /tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage2.stanza|mkdef -z; fi + +cmd: rm -rf /tmp/export_import_multiple_osimages_from_osimage_directory +end + +################################################3 + +start:export_import_specified_from_osimage_directory +description: import specified osimage from osimage diretory with `xcat-inventroy import -d -t osimage -o` +#backup any existing test_myimage +cmd:mkdir -p /tmp/export_import_specified_from_osimage_directory/backup +check:rc==0 +cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza;fi + +#remove any existing test_myimage +cmd:rmdef -t osimage -o test_myimage +cmd: lsdef -t osimage -o test_myimage +check:rc!=0 +cmd: rm -rf /tmp/test_myimage + +#import test_myimage +cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/ -t osimage -o test_myimage +check:rc==0 + +#check whether the osimage definition is created +cmd: lsdef -t osimage -o test_myimage -z |tee /tmp/export_import_specified_from_osimage_directory/test_myimage.stanza +check:rc==0 +cmd: diff /tmp/export_import_specified_from_osimage_directory/test_myimage.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza +check: rc==0 +#check whether the customized osimage files are imported +cmd: diff -r /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/ /tmp/test_myimage/ +check:rc==0 + +#cleanup +cmd:rmdef -t osimage -o test_myimage +cmd:rm -rf /tmp/test_myimage + +#restore the original test_myimage if any +#cmd: [ -e '/tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza' ] && cat /tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza|mkdef -z +cmd: rm -rf /tmp/export_import_specified_from_osimage_directory +end diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/cluster.json b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/cluster.json new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/cluster.json @@ -0,0 +1 @@ + diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/definition.json b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/definition.json new file mode 100644 index 000000000..6f4a69076 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/definition.json @@ -0,0 +1,21 @@ +{ + "osimage": { + "test_myimage": { + "diskpartitionspec": "/tmp/test_myimage/partitionfile", + "filestosync": "/tmp/test_myimage/synclists", + "genimgoptions": { + "exlist": "/tmp/test_myimage/exlist", + "postinstall": "/tmp/test_myimage/postinstall" + }, + "imagetype": "linux", + "package_selection": { + "otherpkglist": "/tmp/test_myimage/otherpkglist", + "pkglist": "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" + }, + "provision_mode": "install", + "template": "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" + } + }, + "schema_version": "1.0" +} +#Version 2.14.1 (git commit ac941fd2501e8a581bfcc4c79b9301f6ec37ab93, built Mon May 21 06:15:46 EDT 2018) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza new file mode 100644 index 000000000..ae4b51f00 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/test_myimage.stanza @@ -0,0 +1,13 @@ +# + +test_myimage: + objtype=osimage + exlist=/tmp/test_myimage/exlist + imagetype=linux + otherpkglist=/tmp/test_myimage/otherpkglist + partitionfile=/tmp/test_myimage/partitionfile + pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist + postinstall=/tmp/test_myimage/postinstall + provmethod=install + synclists=/tmp/test_myimage/synclists + template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/exlist b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/exlist new file mode 100644 index 000000000..791a1f8f5 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/exlist @@ -0,0 +1 @@ +exlist diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/otherpkglist b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/otherpkglist new file mode 100644 index 000000000..4feeb217e --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/otherpkglist @@ -0,0 +1 @@ +otherpkglist diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/partitionfile b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/partitionfile new file mode 100644 index 000000000..81b906ea2 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/partitionfile @@ -0,0 +1 @@ +partitionfile diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/postinstall b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/postinstall new file mode 100644 index 000000000..7d24ce596 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/postinstall @@ -0,0 +1 @@ +postinstall diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/synclists b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/synclists new file mode 100644 index 000000000..adf6202ea --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/tmp/test_myimage/synclists @@ -0,0 +1 @@ +synclists diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/definition.json b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/definition.json new file mode 100644 index 000000000..9e983695c --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/definition.json @@ -0,0 +1,21 @@ +{ + "osimage": { + "test_myimage2": { + "diskpartitionspec": "/tmp/test_myimage2/partitionfile", + "filestosync": "/tmp/test_myimage2/synclists", + "genimgoptions": { + "exlist": "/tmp/test_myimage2/exlist", + "postinstall": "/tmp/test_myimage2/postinstall" + }, + "imagetype": "linux", + "package_selection": { + "otherpkglist": "/tmp/test_myimage2/otherpkglist", + "pkglist": "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" + }, + "provision_mode": "install", + "template": "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" + } + }, + "schema_version": "1.0" +} +#Version 2.14.1 (git commit ac941fd2501e8a581bfcc4c79b9301f6ec37ab93, built Mon May 21 06:15:46 EDT 2018) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/test_myimage2.stanza b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/test_myimage2.stanza new file mode 100644 index 000000000..3edf4dc98 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/test_myimage2.stanza @@ -0,0 +1,13 @@ +# + +test_myimage2: + objtype=osimage + exlist=/tmp/test_myimage2/exlist + imagetype=linux + otherpkglist=/tmp/test_myimage2/otherpkglist + partitionfile=/tmp/test_myimage2/partitionfile + pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist + postinstall=/tmp/test_myimage2/postinstall + provmethod=install + synclists=/tmp/test_myimage2/synclists + template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/exlist b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/exlist new file mode 100644 index 000000000..791a1f8f5 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/exlist @@ -0,0 +1 @@ +exlist diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/otherpkglist b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/otherpkglist new file mode 100644 index 000000000..4feeb217e --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/otherpkglist @@ -0,0 +1 @@ +otherpkglist diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/partitionfile b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/partitionfile new file mode 100644 index 000000000..81b906ea2 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/partitionfile @@ -0,0 +1 @@ +partitionfile diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/postinstall b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/postinstall new file mode 100644 index 000000000..7d24ce596 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/postinstall @@ -0,0 +1 @@ +postinstall diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/synclists b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/synclists new file mode 100644 index 000000000..adf6202ea --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage2/tmp/test_myimage2/synclists @@ -0,0 +1 @@ +synclists From f25c9119f52df47d95ab8794149efcc59a2008cd Mon Sep 17 00:00:00 2001 From: yangsbj Date: Thu, 24 May 2018 03:33:44 -0400 Subject: [PATCH 2/2] refine code according to comments --- .../cases.osimage.import_from_osimage_dir | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir index a628974f9..dff942529 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage.import_from_osimage_dir @@ -9,7 +9,7 @@ cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsd cmd:rmdef -t osimage -o test_myimage cmd: lsdef -t osimage -o test_myimage check:rc!=0 -cmd: rm -rf /tmp/test_myimage +cmd:dir="/tmp/test_myimage";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi #import test_myimage cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage @@ -26,10 +26,10 @@ check:rc==0 #cleanup cmd:rmdef -t osimage -o test_myimage -cmd:rm -rf /tmp/test_myimage +cmd:dir="/tmp/test_myimage"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi #restore the original test_myimage if any -#cmd: [ -e '/tmp/export_import_an_osimage_directory/backup/test_myimage.stanza' ] && cat /tmp/export_import_an_osimage_directory/backup/test_myimage.stanza|mkdef -z +cmd: if [ -e '/tmp/export_import_an_osimage_directory/backup/test_myimage.stanza' ]; then cat /tmp/export_import_an_osimage_directory/backup/test_myimage.stanza|mkdef -z;fi cmd: rm -rf /tmp/export_import_an_osimage_directory end @@ -50,8 +50,8 @@ cmd: lsdef -t osimage -o test_myimage check:rc!=0 cmd: lsdef -t osimage -o test_myimage2 check:rc!=0 -cmd: rm -rf /tmp/test_myimage -cmd: rm -rf /tmp/test_myimage2 +cmd:dir="/tmp/test_myimage";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi +cmd:dir="/tmp/test_myimage2";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi #import osimages cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/ @@ -74,9 +74,10 @@ check:rc==0 #cleanup cmd:rmdef -t osimage -o test_myimage -cmd:rm -rf /tmp/test_myimage +cmd:dir="/tmp/test_myimage"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi + cmd:rmdef -t osimage -o test_myimage2 -cmd:rm -rf /tmp/test_myimage2 +cmd:dir="/tmp/test_myimage2"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi #restore the original osimages if any cmd: if [ -e '/tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage.stanza' ]; then cat /tmp/export_import_multiple_osimages_from_osimage_directory/backup/test_myimage.stanza|mkdef -z;fi @@ -99,7 +100,7 @@ cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsd cmd:rmdef -t osimage -o test_myimage cmd: lsdef -t osimage -o test_myimage check:rc!=0 -cmd: rm -rf /tmp/test_myimage +cmd:dir="/tmp/test_myimage";if [ -d "${dir}" ];then mv ${dir} ${dir}".old"; fi #import test_myimage cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/ -t osimage -o test_myimage @@ -116,9 +117,9 @@ check:rc==0 #cleanup cmd:rmdef -t osimage -o test_myimage -cmd:rm -rf /tmp/test_myimage +cmd:dir="/tmp/test_myimage"; rm -rf $dir; if [ -d ${dir}".old" ];then mv ${dir}".old" $dir; fi #restore the original test_myimage if any -#cmd: [ -e '/tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza' ] && cat /tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza|mkdef -z +cmd: if [ -e '/tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza' ]; then cat /tmp/export_import_specified_from_osimage_directory/backup/test_myimage.stanza|mkdef -z;fi cmd: rm -rf /tmp/export_import_specified_from_osimage_directory end