mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-08-22 19:20:24 +00:00
update cases for task168, support environment variables in osimage in ventory data and files (#5295)
* update cases for task168, support environment variables in osimage inventory data and files * update label for this case * update label for this case * update according to comments * update according to comments
This commit is contained in:
80
xCAT-test/autotest/testcase/xcat-inventory/cases.environment
Normal file
80
xCAT-test/autotest/testcase/xcat-inventory/cases.environment
Normal file
@@ -0,0 +1,80 @@
|
||||
start:import_osimage_with_environments_in_yaml
|
||||
description:this case is to verify if osimage import could support environment variables.
|
||||
os:Linux
|
||||
label:xcat_install,xcat_inventory,provision
|
||||
cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN
|
||||
check:rc==0
|
||||
|
||||
cmd:makedns -n
|
||||
check:rc==0
|
||||
cmd:sleep 20
|
||||
cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]] && [[ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]]; then getmacs -D $$CN; fi
|
||||
check:rc==0
|
||||
cmd:makedhcp -n
|
||||
check:rc==0
|
||||
cmd:makedhcp -a
|
||||
check:rc==0
|
||||
cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done
|
||||
check:rc==0
|
||||
cmd:copycds $$ISO
|
||||
check:rc==0
|
||||
|
||||
cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then mv $rootimgdir $rootimgdir.regbak -f;fi
|
||||
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.yaml
|
||||
check:output=~Importing object: test.environments.osimage
|
||||
check:output=~Inventory import successfully!
|
||||
check:rc==0
|
||||
cmd:lsdef -t osimage -o test.environments.osimage
|
||||
check:rc==0
|
||||
cmd:genimage test.environments.osimage
|
||||
check:rc==0
|
||||
cmd:packimage test.environments.osimage
|
||||
check:rc==0
|
||||
|
||||
cmd:rinstall $$CN osimage=test.environments.osimage
|
||||
check:rc==0
|
||||
check:output=~Provision node\(s\)\: $$CN
|
||||
|
||||
cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi
|
||||
cmd:cat /tmp/mountoutput/file.org
|
||||
cmd:sleep 300
|
||||
cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done
|
||||
|
||||
cmd:ping $$CN -c 3
|
||||
check:rc==0
|
||||
check:output=~64 bytes from $$CN
|
||||
cmd:lsdef -l $$CN | grep status
|
||||
check:rc==0
|
||||
check:output=~booted
|
||||
cmd:xdsh $$CN date
|
||||
check:rc==0
|
||||
check:output=~\d\d:\d\d:\d\d
|
||||
cmd:xdsh $$CN mount
|
||||
check:rc==0
|
||||
check:output=~on / type tmpfs
|
||||
cmd:sleep 120
|
||||
cmd:ping $$CN -c 3
|
||||
check:rc==0
|
||||
check:output=~64 bytes from $$CN
|
||||
|
||||
cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi
|
||||
check:rc==0
|
||||
cmd:xdsh $$CN "cat /var/log/xcat/xcat.log"
|
||||
cmd:xdsh $$CN "cat /tmp/synclist"
|
||||
check:rc==0
|
||||
cmd:xdsh $$CN "cat /tmp/test1.postinstall"
|
||||
check:rc==0
|
||||
check:output=~test postisntall
|
||||
cmd:xdsh $$CN "cat /tmp/test2.postinstall"
|
||||
check:rc==0
|
||||
check:output=~test postisntall
|
||||
cmd:xdsh $$CN "rpm -qa |grep -i conserver-xcat"
|
||||
check:rc==0
|
||||
cmd:xdsh $$CN "rpm -qa |grep -i perl-Net-Telnet"
|
||||
check:rc==0
|
||||
cmd:xdsh $$CN "rpm -qa |grep -i tftp"
|
||||
check:rc==0
|
||||
cmd:xdsh $$CN "rpm -qa |grep -w dhcp"
|
||||
check:rc==0
|
||||
end
|
@@ -0,0 +1 @@
|
||||
conserver-xcat
|
@@ -0,0 +1 @@
|
||||
perl-Net-Telnet
|
@@ -0,0 +1 @@
|
||||
dhcp
|
@@ -0,0 +1 @@
|
||||
tftp
|
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
#-- Do not remove following line if you want to make use of CVS version tracking
|
||||
#-- $Id: compute.postinstall,v 1.21 2008/09/04 12:05:45 sikorsky Exp $
|
||||
#-- jurij.sikorsky@t-systems.cz
|
||||
#--
|
||||
#-- this script is run after all packages from $profile.pkglist are installed
|
||||
#--
|
||||
#-- it gets these arguments:
|
||||
#--
|
||||
#-- $1 = install root (chroot directory for profile)
|
||||
#-- $2 = OS version
|
||||
#-- $3 = architecture
|
||||
#-- $4 = profile name
|
||||
#-- $5 = work dir (where genimage is located)
|
||||
#--
|
||||
#--
|
||||
installroot=$1
|
||||
osver=$2
|
||||
arch=$3
|
||||
profile=$4
|
||||
workdir=$5
|
||||
|
||||
#-- Example how /etc/fstab can be automatically generated during image generation:
|
||||
cat <<END >$installroot/etc/fstab
|
||||
proc /proc proc rw 0 0
|
||||
sysfs /sys sysfs rw 0 0
|
||||
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
|
||||
END
|
||||
|
||||
|
||||
#-- Uncomment the line contains "cons" in /etc/inittab
|
||||
#cons:12345:respawn:/sbin/smart_agetty -L 38400 console
|
||||
echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab
|
||||
|
||||
#-- Disable SELinux in the rootimg
|
||||
#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default
|
||||
#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy"
|
||||
if [ -f "$installroot/etc/selinux/config" ]
|
||||
then
|
||||
sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config
|
||||
fi
|
||||
|
||||
#-- Example of booted image versioning
|
||||
#-- We want to know, with what configuration (version of the image) each node was booted.
|
||||
#-- Hence, we keep image definition files and postscripts in CVS. During image generation we create file /etc/IMGVERSION and fill it with CVS "$Id$" of files with image definition (.pkglist, .exlist, .repolist, .postinstall). Then, during boot, each "CVS enabled" postscript (see /install/postscripts/cvs_template.sh and /install/postscripts/cvs_template.pl) adds one line to /etc/IMGVERSION. Then you can determine in any time what image you are running and what postscipts in which versions were run.
|
||||
#cat /dev/null > $installroot/etc/IMGVERSION
|
||||
#for ext in pkglist exlist postinstall repolist; do
|
||||
# [ -r $workdir/$profile.$ext ] && cat $workdir/$profile.$ext | grep -E '^[[:space:]]*#.*[[:space:]]\$Id' >> $installroot/etc/IMGVERSION
|
||||
#done
|
||||
echo "test postisntall" >> $installroot/tmp/test1.postinstall
|
||||
${GITREPO}/postinstall/test2.postinstall
|
||||
|
@@ -0,0 +1,5 @@
|
||||
#Test for postinstall script
|
||||
installroot=$1
|
||||
echo "test postisntall" >> $installroot/tmp/test2.postinstall
|
||||
|
||||
|
@@ -0,0 +1 @@
|
||||
${GITREPO}/syncfiles/synclist -> /tmp/synclist
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<repomd xmlns="http://linux.duke.edu/metadata/repo" xmlns:rpm="http://linux.duke.edu/metadata/rpm">
|
||||
<revision>1529054651</revision>
|
||||
<data type="filelists">
|
||||
<checksum type="sha256">2f8132e926de0ada34da23f1a63713a9e6761fa5a5171ab309a2aef1d4f6efe3</checksum>
|
||||
<open-checksum type="sha256">eca64f042d41d524c9c40e6fe48c1e21afa2d31a09f82dd478002056931b52f0</open-checksum>
|
||||
<location href="repodata/2f8132e926de0ada34da23f1a63713a9e6761fa5a5171ab309a2aef1d4f6efe3-filelists.xml.gz"/>
|
||||
<timestamp>1529054651</timestamp>
|
||||
<size>664</size>
|
||||
<open-size>2941</open-size>
|
||||
</data>
|
||||
<data type="primary">
|
||||
<checksum type="sha256">8a1f4155ca9e8784d0a41e5a9b5b715af7f096945143e6be4f69489eb59a4aa8</checksum>
|
||||
<open-checksum type="sha256">623db61f62a982b63ead5171a5fa6b04ab09f19975df695b4f6d3ac3b7b3fa92</open-checksum>
|
||||
<location href="repodata/8a1f4155ca9e8784d0a41e5a9b5b715af7f096945143e6be4f69489eb59a4aa8-primary.xml.gz"/>
|
||||
<timestamp>1529054651</timestamp>
|
||||
<size>1667</size>
|
||||
<open-size>4726</open-size>
|
||||
</data>
|
||||
<data type="primary_db">
|
||||
<checksum type="sha256">98590d4faf7b8f997493a85d6fcbb6aa2ede7a9b30078ecc06d5710c0520dc56</checksum>
|
||||
<open-checksum type="sha256">2cae2914ab3574b7d97a4a971f7556282a0bfbecd9ef3ebc3ba0836c6126cc7c</open-checksum>
|
||||
<location href="repodata/98590d4faf7b8f997493a85d6fcbb6aa2ede7a9b30078ecc06d5710c0520dc56-primary.sqlite.bz2"/>
|
||||
<timestamp>1529054653</timestamp>
|
||||
<database_version>10</database_version>
|
||||
<size>3376</size>
|
||||
<open-size>23552</open-size>
|
||||
</data>
|
||||
<data type="other_db">
|
||||
<checksum type="sha256">771b092d010ec878233b66dc1dba2ab81b614c5a9ea473f9f5f6da76997276c1</checksum>
|
||||
<open-checksum type="sha256">b539bc27136e110f6147ea3265153dda8096f11987a1383adb6c991471d05b7b</open-checksum>
|
||||
<location href="repodata/771b092d010ec878233b66dc1dba2ab81b614c5a9ea473f9f5f6da76997276c1-other.sqlite.bz2"/>
|
||||
<timestamp>1529054652</timestamp>
|
||||
<database_version>10</database_version>
|
||||
<size>1359</size>
|
||||
<open-size>8192</open-size>
|
||||
</data>
|
||||
<data type="other">
|
||||
<checksum type="sha256">bd36e0c2e540280fd45799e9f755a72f63b394ce110227f7d48f999a86d90ede</checksum>
|
||||
<open-checksum type="sha256">9e9e4f10ecd14f0a067bf48948b241e9b83d0d73619864d5185d0d4bafdf95f8</open-checksum>
|
||||
<location href="repodata/bd36e0c2e540280fd45799e9f755a72f63b394ce110227f7d48f999a86d90ede-other.xml.gz"/>
|
||||
<timestamp>1529054651</timestamp>
|
||||
<size>729</size>
|
||||
<open-size>2108</open-size>
|
||||
</data>
|
||||
<data type="filelists_db">
|
||||
<checksum type="sha256">e3cf2fc42c62b0328effe9e44a4ab1296905ae92f845dd773b0550c7f191e3f8</checksum>
|
||||
<open-checksum type="sha256">4d88f10b76e7bf9ff1e25aa53c8415e6959d6f1cc3a1371ee424ee2d8459cfcb</open-checksum>
|
||||
<location href="repodata/e3cf2fc42c62b0328effe9e44a4ab1296905ae92f845dd773b0550c7f191e3f8-filelists.sqlite.bz2"/>
|
||||
<timestamp>1529054652</timestamp>
|
||||
<database_version>10</database_version>
|
||||
<size>1628</size>
|
||||
<open-size>9216</open-size>
|
||||
</data>
|
||||
</repomd>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<repomd xmlns="http://linux.duke.edu/metadata/repo" xmlns:rpm="http://linux.duke.edu/metadata/rpm">
|
||||
<revision>1528961260</revision>
|
||||
<data type="filelists">
|
||||
<checksum type="sha256">4160c0db6523d465541345245e8463eacd03e5f823e5ba319d0ddbed4b2a2397</checksum>
|
||||
<open-checksum type="sha256">bcff832273199f571ac15e62d127f4eb8df6a51100a949f68213ba70330c3fe9</open-checksum>
|
||||
<location href="repodata/4160c0db6523d465541345245e8463eacd03e5f823e5ba319d0ddbed4b2a2397-filelists.xml.gz"/>
|
||||
<timestamp>1528961260</timestamp>
|
||||
<size>527</size>
|
||||
<open-size>1805</open-size>
|
||||
</data>
|
||||
<data type="primary">
|
||||
<checksum type="sha256">75c2df3e4d5ca66a0c105562f4d0cea1c0c1203bb1f59a73e373b5cebcf03d65</checksum>
|
||||
<open-checksum type="sha256">7701b889349f89e485ec68b1346a636853fb7554069f0ac92f104d498c54f767</open-checksum>
|
||||
<location href="repodata/75c2df3e4d5ca66a0c105562f4d0cea1c0c1203bb1f59a73e373b5cebcf03d65-primary.xml.gz"/>
|
||||
<timestamp>1528961260</timestamp>
|
||||
<size>1269</size>
|
||||
<open-size>3406</open-size>
|
||||
</data>
|
||||
<data type="primary_db">
|
||||
<checksum type="sha256">e4f965fd5f4b914c4e89d54b8784394b7760e051dd788e791d259673af365373</checksum>
|
||||
<open-checksum type="sha256">af8b49cdc4a0219f531fcbd559cb19808aea1055f010aea9b41cb66dd94ebd5d</open-checksum>
|
||||
<location href="repodata/e4f965fd5f4b914c4e89d54b8784394b7760e051dd788e791d259673af365373-primary.sqlite.bz2"/>
|
||||
<timestamp>1528961262</timestamp>
|
||||
<database_version>10</database_version>
|
||||
<size>2967</size>
|
||||
<open-size>21504</open-size>
|
||||
</data>
|
||||
<data type="other_db">
|
||||
<checksum type="sha256">811daeb0fde54384fec22af72ecdcdd2d4d8060ad5227802c0c02bb73dd72ce1</checksum>
|
||||
<open-checksum type="sha256">bcf276a03b51aad62cb750782f5ffd6d20d4eb327d6bf6bb1ec329fde9f63b78</open-checksum>
|
||||
<location href="repodata/811daeb0fde54384fec22af72ecdcdd2d4d8060ad5227802c0c02bb73dd72ce1-other.sqlite.bz2"/>
|
||||
<timestamp>1528961261</timestamp>
|
||||
<database_version>10</database_version>
|
||||
<size>1388</size>
|
||||
<open-size>8192</open-size>
|
||||
</data>
|
||||
<data type="other">
|
||||
<checksum type="sha256">9fcfad63d06bdaba2be3507fbb1cd080db5f7423ec46cf25221fb1193e35611b</checksum>
|
||||
<open-checksum type="sha256">336bfd6337f648db1b6ba085a94b88bc79c20e1be056d1c168a88b6d62c15c0e</open-checksum>
|
||||
<location href="repodata/9fcfad63d06bdaba2be3507fbb1cd080db5f7423ec46cf25221fb1193e35611b-other.xml.gz"/>
|
||||
<timestamp>1528961260</timestamp>
|
||||
<size>749</size>
|
||||
<open-size>2026</open-size>
|
||||
</data>
|
||||
<data type="filelists_db">
|
||||
<checksum type="sha256">2a9abe54b23615850e70c41456bd49ff3994eae972ea2347d46b43de8cf48931</checksum>
|
||||
<open-checksum type="sha256">36d40a93865269f7f5d5fa69ac32b2eb2090061451adbcb57ccde1dbd15bc5e4</open-checksum>
|
||||
<location href="repodata/2a9abe54b23615850e70c41456bd49ff3994eae972ea2347d46b43de8cf48931-filelists.sqlite.bz2"/>
|
||||
<timestamp>1528961261</timestamp>
|
||||
<database_version>10</database_version>
|
||||
<size>1482</size>
|
||||
<open-size>7168</open-size>
|
||||
</data>
|
||||
</repomd>
|
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
osimage:
|
||||
test.environments.osimage:
|
||||
basic_attributes:
|
||||
arch: ppc64le
|
||||
distribution: rhels7.5-alternate
|
||||
osdistro: rhels7.5-alternate-ppc64le
|
||||
osname: Linux
|
||||
filestosync: {{GITREPO}}/syncfiles/synclist
|
||||
deprecated:
|
||||
comments: rhels7.5,test_environment_variables
|
||||
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'
|
Reference in New Issue
Block a user