From adab82de4b1750bfbfa5303e6a844474b7ba1bec Mon Sep 17 00:00:00 2001 From: bxuxa Date: Tue, 20 Nov 2018 17:52:10 +0800 Subject: [PATCH 1/4] upgrade to travis xenial env --- .travis.yml | 6 ++--- travis.pl | 28 +++++++++++----------- xCAT-server/lib/xcat/monitoring/snmpmon.pm | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 507fd0a77..d8f18824b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ os: linux -dist: trusty +dist: xenial sudo: required before_install: -- sudo apt-get install -y git reprepro devscripts debhelper libsoap-lite-perl libdbi-perl quilt openssh-server dpkg looptools genometools software-properties-common +- sudo apt-get install -y git fakeroot reprepro devscripts debhelper libcapture-tiny-perl libjson-perl libsoap-lite-perl libdbi-perl quilt openssh-server dpkg looptools genometools software-properties-common - perl -v -- echo "yes" | sudo cpan -f -i Capture::Tiny +#- echo "yes" | sudo cpan -f -i Capture::Tiny script: - echo $TRAVIS_BUILD_ID diff --git a/travis.pl b/travis.pl index 61b11e433..801265de6 100644 --- a/travis.pl +++ b/travis.pl @@ -271,19 +271,19 @@ sub send_back_comment{ #-------------------------------------------------------- sub build_xcat_core{ my @output; - my @cmds = ("gpg --list-keys", - "sed -i '/SignWith: /d' $ENV{'PWD'}/build-ubunturepo"); - foreach my $cmd (@cmds){ - print "[build_xcat_core] running $cmd\n"; - @output = runcmd("$cmd"); - if($::RUNCMD_RC){ - print "[build_xcat_core] $cmd ....[Failed]\n"; - send_back_comment("> **BUILD ERROR** : $cmd failed. Please click ``Details`` label in ``Merge pull request`` box for detailed information"); - return 1; - } - } + #my @cmds = ("gpg --list-keys", + # "sed -i '/SignWith: /d' $ENV{'PWD'}/build-ubunturepo"); + #foreach my $cmd (@cmds){ + # print "[build_xcat_core] running $cmd\n"; + # @output = runcmd("$cmd"); + # if($::RUNCMD_RC){ + # print "[build_xcat_core] $cmd ....[Failed]\n"; + # send_back_comment("> **BUILD ERROR** : $cmd failed. Please click ``Details`` label in ``Merge pull request`` box for detailed information"); + # return 1; + # } + #} - my $cmd = "sudo ./build-ubunturepo -c UP=0 BUILDALL=1"; + my $cmd = "sudo ./build-ubunturepo -c UP=0 BUILDALL=1 GPGSIGN=0"; @output = runcmd("$cmd"); print ">>>>>Dumper the output of '$cmd'\n"; print Dumper \@output; @@ -321,8 +321,8 @@ sub install_xcat{ my @cmds = ("cd ./../../xcat-core && sudo ./mklocalrepo.sh", "sudo chmod 777 /etc/apt/sources.list", - "sudo echo \"deb [arch=amd64] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep trusty main\" >> /etc/apt/sources.list", - "sudo echo \"deb [arch=ppc64el] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep trusty main\" >> /etc/apt/sources.list", + "sudo echo \"deb [arch=amd64] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep xenial main\" >> /etc/apt/sources.list", + "sudo echo \"deb [arch=ppc64el] http://xcat.org/files/xcat/repos/apt/2.14/xcat-dep xenial main\" >> /etc/apt/sources.list", "sudo wget -q -O - \"http://xcat.org/files/xcat/repos/apt/apt.key\" | sudo apt-key add -", "sudo apt-get -qq update"); my @output; diff --git a/xCAT-server/lib/xcat/monitoring/snmpmon.pm b/xCAT-server/lib/xcat/monitoring/snmpmon.pm index 75a8f26bb..a8e35eab9 100644 --- a/xCAT-server/lib/xcat/monitoring/snmpmon.pm +++ b/xCAT-server/lib/xcat/monitoring/snmpmon.pm @@ -759,7 +759,7 @@ sub configSwitch { my $table = xCAT::Table->new('switches', -create => 0); if ($table) { my @tmp1 = $table->getAllAttribs(('switch')); - if (defined(@tmp1) && (@tmp1 > 0)) { + if (scalar @tmp1 > 0) { foreach (@tmp1) { my @switches_tmp = noderange($_->{switch}); if (@switches_tmp == 0) { push @switches_tmp, $_->{switch}; } @@ -1360,7 +1360,7 @@ sub getNodesMonServers my $table = xCAT::Table->new('switches', -create => 0); if ($table) { my @tmp1 = $table->getAllAttribs(('switch')); - if (defined(@tmp1) && (@tmp1 > 0)) { + if (scalar @tmp1 > 0) { foreach (@tmp1) { my @switches_tmp = noderange($_->{switch}); if (@switches_tmp == 0) { push @switches_tmp, $_->{switch}; } From efc209ca5c0556b990570c783c97d86fae63f0db Mon Sep 17 00:00:00 2001 From: bxuxa Date: Tue, 20 Nov 2018 19:07:35 +0800 Subject: [PATCH 2/4] allow insecure --- travis.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/travis.pl b/travis.pl index 801265de6..e02784c9c 100644 --- a/travis.pl +++ b/travis.pl @@ -321,8 +321,8 @@ sub install_xcat{ my @cmds = ("cd ./../../xcat-core && sudo ./mklocalrepo.sh", "sudo chmod 777 /etc/apt/sources.list", - "sudo echo \"deb [arch=amd64] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep xenial main\" >> /etc/apt/sources.list", - "sudo echo \"deb [arch=ppc64el] http://xcat.org/files/xcat/repos/apt/2.14/xcat-dep xenial main\" >> /etc/apt/sources.list", + "sudo echo \"deb [arch=amd64 allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep xenial main\" >> /etc/apt/sources.list", + "sudo echo \"deb [arch=ppc64el allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep xenial main\" >> /etc/apt/sources.list", "sudo wget -q -O - \"http://xcat.org/files/xcat/repos/apt/apt.key\" | sudo apt-key add -", "sudo apt-get -qq update"); my @output; From c2c515912858998d9123e7b069959dea304e9104 Mon Sep 17 00:00:00 2001 From: bxuxa Date: Tue, 20 Nov 2018 20:12:42 +0800 Subject: [PATCH 3/4] remove unsuitable test cases --- travis.pl | 8 +++++++- xCAT-test/autotest/bundle/MN_basic.bundle | 6 +++--- xCAT-test/autotest/testcase/makedhcp/cases0 | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/travis.pl b/travis.pl index e02784c9c..01d87e1b8 100644 --- a/travis.pl +++ b/travis.pl @@ -488,7 +488,6 @@ sub run_fast_regression_test{ @output = runcmd("cat $conf_file"); print Dumper \@output; - # $cmd = "sudo bash -c '. /etc/profile.d/xcat.sh && xcattest -s \"mn_only-wait_fix\" -l'"; # my @caseslist = runcmd("$cmd"); # if($::RUNCMD_RC){ @@ -613,6 +612,13 @@ my @disk = runcmd("df -h"); print "Disk information:\n"; print Dumper \@disk; +runcmd("sudo ip link set docker0 up"); +my @ipinfo = runcmd("ip addr"); +print "Networking information:\n"; +print Dumper \@ipinfo; +my @hostinfo = runcmd("cat /etc/hosts"); +print Dumper \@hostinfo; + #Start to check the format of pull request $last_func_start = timelocal(localtime()); print GREEN "\n------ Checking Pull Request Format ------\n"; diff --git a/xCAT-test/autotest/bundle/MN_basic.bundle b/xCAT-test/autotest/bundle/MN_basic.bundle index b093ba584..de3e09758 100644 --- a/xCAT-test/autotest/bundle/MN_basic.bundle +++ b/xCAT-test/autotest/bundle/MN_basic.bundle @@ -58,9 +58,9 @@ lsxcatd_a lsxcatd_d lsxcatd_h lsxcatd_null -makeconservercf_d -makeconservercf_noderange -makeconservercf_null +#makeconservercf_d +#makeconservercf_noderange +#makeconservercf_null #makedhcp_a_d_linux #makedhcp_a_linux #makedhcp_d_linux diff --git a/xCAT-test/autotest/testcase/makedhcp/cases0 b/xCAT-test/autotest/testcase/makedhcp/cases0 index 359c5a97d..818ca9173 100644 --- a/xCAT-test/autotest/testcase/makedhcp/cases0 +++ b/xCAT-test/autotest/testcase/makedhcp/cases0 @@ -5,7 +5,7 @@ label:mn_only,ci_test,dhcp cmd:if [ -f "/etc/dhcp/dhcpd.conf" ];then mv -f /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak ; elif [ -f "/etc/dhcpd.conf" ]; then mv -f /etc/dhcpd.conf /etc/dhcpd.conf.bak; fi cmd:makedhcp -n check:rc==0 -cmd:ls /etc/dhcp/dhcpd.conf || ls /etc/dhcpd.conf +cmd:cat $(ls /etc/dhcp/dhcpd.conf || ls /etc/dhcpd.conf) check:rc==0 cmd:sleep 20 cmd:ps -e | grep dhcpd From 22cb310e224da2235cffa831b5144c3a31695503 Mon Sep 17 00:00:00 2001 From: bxuxa Date: Wed, 21 Nov 2018 10:25:38 +0800 Subject: [PATCH 4/4] fix makedhcp_n failed due to netmask is 32 length --- travis.pl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/travis.pl b/travis.pl index 01d87e1b8..4891d4017 100644 --- a/travis.pl +++ b/travis.pl @@ -612,12 +612,16 @@ my @disk = runcmd("df -h"); print "Disk information:\n"; print Dumper \@disk; -runcmd("sudo ip link set docker0 up"); +# Hacking the netmask. Not sure if we need to recover it after finish xcattest +# Note: Here has an assumption from Travis VM: only 1 UP Ethernet interface available (CHANGEME if it not as is) +my @intfinfo = runcmd("ip -o link |grep 'link/ether'|grep 'state UP' |awk -F ':' '{print \$2}'|head -1"); +foreach my $nic (@intfinfo) { + print "Hacking the netmask length to 16 if it is 32: $nic\n"; + runcmd("ip -4 addr show $nic|grep 'inet'|grep -q '/32' && sudo ip addr add \$(hostname -I|awk '{print \$1}')/16 dev $nic"); +} my @ipinfo = runcmd("ip addr"); print "Networking information:\n"; print Dumper \@ipinfo; -my @hostinfo = runcmd("cat /etc/hosts"); -print Dumper \@hostinfo; #Start to check the format of pull request $last_func_start = timelocal(localtime());