diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.environment b/xCAT-test/autotest/testcase/xcat-inventory/cases.environment index 2e813af3c..f0c269173 100644 --- a/xCAT-test/autotest/testcase/xcat-inventory/cases.environment +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.environment @@ -78,3 +78,45 @@ check:rc==0 cmd:xdsh $$CN "rpm -qa |grep -w dhcp" check:rc==0 end + +start:export_osimage_with_environments +description:this case is to verify if osimage export could support environment variables. +os:Linux +label:others,xcat_inventory +cmd:lsdef -t osimage -o test.environments.osimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test.environments.osimage -z >/tmp/test.environments.osimage_image.stanza ;rmdef -t osimage -o test.environments.osimage;fi +check:rc==0 +cmd:dir="/tmp/export";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir +cmd:export GITREPO="/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo";export SWDIR="/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/swdir";xcat-inventory import -f /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml +check:output=~Importing object: test.environments.osimage +check:output=~Inventory import successfully! +check:rc==0 +cmd:lsdef -t osimage -o test.environments.osimage -z >> /tmp/export/test.environments.osimage.yaml.stanza +check:rc==0 +cmd:diff -y /tmp/export/test.environments.osimage.yaml.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza +check:rc==0 +cmd:xcat-inventory export -t osimage -o test.environments.osimage -f /tmp/export/test.environments.osimage.yaml --format yaml +check:rc==0 +check:output=~The inventory data has been dumped to /tmp/export/test.environments.osimage.yaml +cmd:diff -y /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml /tmp/export/test.environments.osimage.yaml --ignore-blank-lines -I "^#" +check:rc==0 +cmd:rmdef -t osimage -o test.environments.osimage +check:rc==0 +cmd:export GITREPO="/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo";export SWDIR="/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/swdir";xcat-inventory import -f /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json +check:output=~Importing object: test.environments.osimage +check:output=~Inventory import successfully! +check:rc==0 +cmd:lsdef -t osimage -o test.environments.osimage -z >> /tmp/export/test.environments.osimage.json.stanza +check:rc==0 +cmd:diff -y /tmp/export/test.environments.osimage.json.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza +check:rc==0 +cmd:xcat-inventory export -t osimage -o test.environments.osimage -f /tmp/export/test.environments.osimage.json +check:rc==0 +cmd:diff -y /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json /tmp/export/test.environments.osimage.json --ignore-blank-lines -I "^#" +check:rc==0 +cmd:dir="/tmp/export"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi +cmd: rmdef -t osimage -o test.environments.osimage +check:rc==0 +cmd: if [ -e /tmp/test.environments.osimage.stanza ]; then cat /tmp/test.environments.osimage.stanza |mkdef -z;fi +end + + diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza b/xCAT-test/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza new file mode 100644 index 000000000..903363536 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza @@ -0,0 +1,21 @@ +# + +test.environments.osimage: + objtype=osimage + environvar=GITREPO=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo,SWDIR=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/swdir + imagetype=linux + osarch=ppc64le + osdistroname=rhels7.5-alternate-ppc64le + osname=Linux + osvers=rhels7.5-alternate + otherpkgdir=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/swdir/otherpkgdir/ + otherpkglist=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo/otherpkglist/test1.otherpkglist,/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo/otherpkglist/test2.otherpkglist, + permission=755 + pkgdir=/install/rhels7.5-alternate/ppc64le,/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/swdir/pkgdir/ + pkglist=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist,/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo/pkglist/test1.pkglist,/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo/pkglist/test2.pkglist + postinstall=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall,/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo/postinstall/test1.postinstall + profile=compute + provmethod=netboot + rootimgdir=/install/custom/test.environments.osimage + synclists=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo/syncfiles/synclist + usercomment=rhels7.5,test_environment_variables diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json b/xCAT-test/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json new file mode 100644 index 000000000..68752808b --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json @@ -0,0 +1,50 @@ +{ + "osimage": { + "test.environments.osimage": { + "basic_attributes": { + "arch": "ppc64le", + "distribution": "rhels7.5-alternate", + "osdistro": "rhels7.5-alternate-ppc64le", + "osname": "Linux" + }, + "deprecated": { + "comments": "rhels7.5,test_environment_variables" + }, + "filestosync": [ + "{{GITREPO}}/syncfiles/synclist" + ], + "genimgoptions": { + "permission": "755", + "postinstall": [ + "/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall", + "{{GITREPO}}/postinstall/test1.postinstall" + ], + "rootimgdir": "/install/custom/test.environments.osimage" + }, + "imagetype": "linux", + "package_selection": { + "otherpkgdir": [ + "{{SWDIR}}/otherpkgdir/" + ], + "otherpkglist": [ + "{{GITREPO}}/otherpkglist/test1.otherpkglist", + "{{GITREPO}}/otherpkglist/test2.otherpkglist", + "" + ], + "pkgdir": [ + "/install/rhels7.5-alternate/ppc64le", + "{{SWDIR}}/pkgdir/" + ], + "pkglist": [ + "/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist", + "{{GITREPO}}/pkglist/test1.pkglist", + "{{GITREPO}}/pkglist/test2.pkglist" + ] + }, + "provision_mode": "netboot", + "role": "compute" + } + }, + "schema_version": "1.0" +} +#Version 2.14.2 (git commit 09f0772835afdc0f962c9e7fe8cef862e9505ad7, built Tue Jun 19 01:58:56 EDT 2018) diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml b/xCAT-test/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml new file mode 100644 index 000000000..c4f10968e --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml @@ -0,0 +1,35 @@ +osimage: + test.environments.osimage: + basic_attributes: + arch: ppc64le + distribution: rhels7.5-alternate + osdistro: rhels7.5-alternate-ppc64le + osname: Linux + deprecated: + comments: rhels7.5,test_environment_variables + filestosync: + - '{{GITREPO}}/syncfiles/synclist' + genimgoptions: + permission: '755' + postinstall: + - /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall + - '{{GITREPO}}/postinstall/test1.postinstall' + rootimgdir: /install/custom/test.environments.osimage + imagetype: linux + package_selection: + otherpkgdir: + - '{{SWDIR}}/otherpkgdir/' + otherpkglist: + - '{{GITREPO}}/otherpkglist/test1.otherpkglist' + - '{{GITREPO}}/otherpkglist/test2.otherpkglist' + - '' + pkgdir: + - /install/rhels7.5-alternate/ppc64le + - '{{SWDIR}}/pkgdir/' + pkglist: + - /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist + - '{{GITREPO}}/pkglist/test1.pkglist' + - '{{GITREPO}}/pkglist/test2.pkglist' + provision_mode: netboot + role: compute +schema_version: '1.0'