2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-25 12:40:21 +00:00

Merge branch 'master' into fix_cfg

This commit is contained in:
Yuan Bai
2019-03-22 12:28:39 +08:00
committed by GitHub
21 changed files with 154 additions and 68 deletions

View File

@@ -0,0 +1,68 @@
%undefine __brp_mangle_shebangs
Summary: xCAT openbmc python3
Name: xCAT-openbmc-py3
#Version: %{?version:%{version}}%{!?version:%(cat Version)}
Version: 2.14.6
Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")}
Epoch: 1
License: EPL
Group: Applications/System
Source: xCAT-openbmc-py-%{version}.tar.gz
Packager: IBM Corp.
Vendor: IBM Corp.
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
Prefix: /opt/xcat
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
%ifnos linux
AutoReqProv: no
%endif
BuildArch: noarch
Requires: xCAT-server
Requires: python3-gevent >= 1.2.2-2
Requires: python3-greenlet >= 0.4.13-2
Requires: python3-paramiko >= 2.0.0
Requires: python3-docopt python3-requests python3-scp
%description
xCAT-openbmc-py3 provides openbmc related functions python3 based.
%prep
%setup -q -n xCAT-openbmc-py
%build
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/%{prefix}/lib/python/agent
install -d $RPM_BUILD_ROOT/%{prefix}/lib/python/agent/xcatagent
install -d $RPM_BUILD_ROOT/%{prefix}/lib/python/agent/common
install -d $RPM_BUILD_ROOT/%{prefix}/lib/python/agent/hwctl
install -d $RPM_BUILD_ROOT/%{prefix}/lib/python/agent/hwctl/openbmc
install -d $RPM_BUILD_ROOT/%{prefix}/lib/python/agent/hwctl/redfish
install -m755 lib/python/agent/*.py $RPM_BUILD_ROOT/%{prefix}/lib/python/agent
install -m644 lib/python/agent/xcatagent/*.py $RPM_BUILD_ROOT/%{prefix}/lib/python/agent/xcatagent
install -m644 lib/python/agent/common/*.py $RPM_BUILD_ROOT/%{prefix}/lib/python/agent/common
install -m644 lib/python/agent/hwctl/*.py $RPM_BUILD_ROOT/%{prefix}/lib/python/agent/hwctl
install -m644 lib/python/agent/hwctl/openbmc/*.py $RPM_BUILD_ROOT/%{prefix}/lib/python/agent/hwctl/openbmc/
install -m644 lib/python/agent/hwctl/redfish/*.py $RPM_BUILD_ROOT/%{prefix}/lib/python/agent/hwctl/redfish/
%ifnos linux
rm -rf $RPM_BUILD_ROOT/%{prefix}/lib/python/agent
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{prefix}
%changelog
%pre
%post
%preun

View File

@@ -503,11 +503,13 @@ sub is_goconserver_running {
sub switch_goconserver {
my $callback = shift;
# ignore SN as it is handled by AAsn
if ((-x "/usr/bin/systemctl" || -x "-x /bin/systemctl") && !$isSN) {
if ((-x "/usr/bin/systemctl" || -x "/bin/systemctl") && !$isSN) {
my $cmd = "systemctl disable conserver";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
xCAT::MsgUtils->warn_message("Failed to execute command: $cmd.", $callback);
if (-x "/usr/sbin/conserver") {
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
xCAT::MsgUtils->warn_message("Failed to execute command: $cmd.", $callback);
}
}
$cmd = "systemctl enable goconserver";
xCAT::Utils->runcmd($cmd, -1);
@@ -535,11 +537,13 @@ sub switch_goconserver {
sub switch_conserver {
my $callback = shift;
# ignore SN as it is handled by AAsn
if ((-x "/usr/bin/systemctl" || -x "-x /bin/systemctl") && !$isSN) {
if ((-x "/usr/bin/systemctl" || -x "/bin/systemctl") && !$isSN) {
my $cmd = "systemctl disable goconserver";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
xCAT::MsgUtils->warn_message("Failed to execute command: $cmd.", $callback);
if (-x "/usr/bin/goconserver") {
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
xCAT::MsgUtils->warn_message("Failed to execute command: $cmd.", $callback);
}
}
$cmd = "systemctl enable conserver";
xCAT::Utils->runcmd($cmd, -1);

View File

@@ -394,7 +394,7 @@ sub subvars {
$inc =~ s/#COLONHTTPPORT#/$httpportsuffix/eg;
if (($::XCATSITEVALS{xcatdebugmode} eq "1") or ($::XCATSITEVALS{xcatdebugmode} eq "2")) {
$inc =~ s/#UNCOMMENTOENABLEDEBUGPORT#/ /g;
$inc =~ s/#UNCOMMENTOENABLEDEBUGPORT#//g;
}
if ($::XCATSITEVALS{xcatdebugmode} eq "2") {

View File

@@ -77,7 +77,7 @@ try:
received = newSocket.recv(200)
if not received:
break
command = re.split('\s+',received)
command = re.split(b'\s+',received)
if(command[0] == b"stat"):
ilog = ""
line = ""
@@ -113,11 +113,11 @@ try:
newSocket.send(line.encode())
break
#UNCOMMENTOENABLEDEBUGPORT# if(command[0] == b"sh"): #DEBUG purposes only, wide open root priv command here.
#UNCOMMENTOENABLEDEBUGPORT# newcommand = ""
#UNCOMMENTOENABLEDEBUGPORT# newcommand = b""
#UNCOMMENTOENABLEDEBUGPORT# for i in command[1:]:
#UNCOMMENTOENABLEDEBUGPORT# newcommand = newcommand + i + " "
#UNCOMMENTOENABLEDEBUGPORT# output = os.popen(newcommand).read()
#UNCOMMENTOENABLEDEBUGPORT# newSocket.send(output.encode())
#UNCOMMENTOENABLEDEBUGPORT# newcommand = newcommand + i + b" "
#UNCOMMENTOENABLEDEBUGPORT# output = os.popen(newcommand.decode('utf-8')).read().encode()
#UNCOMMENTOENABLEDEBUGPORT# newSocket.send(output)
#UNCOMMENTOENABLEDEBUGPORT# break
if(command[0] == b"screendump"):
newcommand = "cat /dev/vcs"

View File

@@ -69,11 +69,16 @@ xCATCmd () {
ARCH=`uname -m`
if [ x$ARCH = x"ppc64" -a x$OS = x"rh" ]; then
/usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -quiet -no_ssl3 \
$(/usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -help 2>&1 |
grep -m 1 -o -- -no_ssl2) \
-connect ${1} -rand /bin/bash 2>/dev/null \
<<<"<xcatrequest><command>${2}</command></xcatrequest>"
else
LD_LIBRARY_PATH=${MNTDIR}/lib64:${MNTDIR}/usr/lib64 \
${MNTDIR}/usr/bin/openssl s_client -quiet -no_ssl3 \
$(LD_LIBRARY_PATH=${MNTDIR}/lib64:${MNTDIR}/usr/lib64 \
${MNTDIR}/usr/bin/openssl s_client -help 2>&1 |
grep -m 1 -o -- -no_ssl2) \
-connect ${1} -rand /bin/bash 2>/dev/null \
<<<"<xcatrequest><command>${2}</command></xcatrequest>"
fi

View File

@@ -128,7 +128,7 @@ GetSyncInfo () {
xCATCmd () {
# $1 is the xCAT server
# $2 is the command
LD_LIBRARY_PATH=${MNTDIR}/lib64:${MNTDIR}/usr/lib64 ${MNTDIR}/usr/bin/openssl s_client -quiet -no_ssl3 -connect ${1} -rand /bin/bash 2>/dev/null <<<"<xcatrequest><command>${2}</command></xcatrequest>"
LD_LIBRARY_PATH=${MNTDIR}/lib64:${MNTDIR}/usr/lib64 ${MNTDIR}/usr/bin/openssl s_client -quiet -no_ssl3 $(LD_LIBRARY_PATH=${MNTDIR}/lib64:${MNTDIR}/usr/lib64 ${MNTDIR}/usr/bin/openssl s_client -help 2>&1 | grep -m 1 -o -- -no_ssl2) -connect ${1} -rand /bin/bash 2>/dev/null <<<"<xcatrequest><command>${2}</command></xcatrequest>"
}

View File

@@ -128,7 +128,7 @@ GetSyncInfo () {
xCATCmd () {
# $1 is the xCAT server
# $2 is the command
echo "<xcatrequest>\n<command>${2}</command>\n</xcatrequest>" | /usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -quiet -no_ssl3 -connect ${1} -rand /bin/nice 2>/dev/null
echo "<xcatrequest>\n<command>${2}</command>\n</xcatrequest>" | /usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -quiet -no_ssl3 $(/usr/sbin/chroot ${MNTDIR} /usr/bin/openssl s_client -help 2>&1 | grep -m 1 -o -- -no_ssl2) -connect ${1} -rand /bin/nice 2>/dev/null
}

View File

@@ -69,3 +69,4 @@ rpower_reset
runcmdinstaller_command
redhat_migration1
redhat_migration2
linux_diskless_kdump

View File

@@ -72,3 +72,4 @@ rpower_reset
runcmdinstaller_command
redhat_migration1
redhat_migration2
linux_diskless_kdump

View File

@@ -72,3 +72,4 @@ rpower_reset
runcmdinstaller_command
redhat_migration1
redhat_migration2
linux_diskless_kdump

View File

@@ -12,3 +12,4 @@ reg_linux_diskless_installation_flat
reg_linux_statelite_installation_flat
sles_migration1
sles_migration2
linux_diskless_kdump

View File

@@ -19,3 +19,4 @@ reg_linux_diskless_installation_flat
reg_linux_statelite_installation_flat
sles_migration1
sles_migration2
linux_diskless_kdump

View File

@@ -19,3 +19,4 @@ reg_linux_diskless_installation_flat
reg_linux_statelite_installation_flat
sles_migration1
sles_migration2
linux_diskless_kdump

View File

@@ -14,3 +14,4 @@ packimage_m_tar_c_xz
packimage_o_p_a_m
rmimage_diskless
ubuntu_migration2_p8le
linux_diskless_kdump

View File

@@ -14,3 +14,4 @@ packimage_m_tar_c_xz
packimage_o_p_a_m
rmimage_diskless
ubuntu_migration2_vm
linux_diskless_kdump

View File

@@ -101,7 +101,7 @@ if [ ! -z "$DUMP" ]; then
MOUNTPATH=""
if (pmatch $OSVER "*6\.*"); then
MOUNTPATH="/tmp"
elif (pmatch $OSVER "*7\.*"); then
elif (pmatch $OSVER "*[78]\.*"); then
MOUNTPATH="/mnt"
else
MOUNTPATH="/var/tmp"
@@ -215,7 +215,7 @@ EOF
mv ${oldremount}.bak $oldremount
fi
else
if (pmatch $OSVER "rhel7*") || (pmatch $OSVER "rhels7*");then
if (pmatch $OSVER "rhel[78]*") || (pmatch $OSVER "rhels[78]*");then
nfsvers=$(/usr/sbin/rpcinfo -p $KDIP|grep -w nfs|awk /tcp/'{print $2}'|sort)
nfsver=0
if [ -n "$nfsvers" ]; then
@@ -246,8 +246,10 @@ EOF
echo "nfs $KDIP:$KDPATH" > /etc/kdump.conf
echo "default shell" >> /etc/kdump.conf
#strip "xcat" out of the initramfs for kdump
echo "dracut_args --omit \"xcat\"" >> /etc/kdump.conf
if (pmatch $OSVER "rhel7*") || (pmatch $OSVER "rhels7*");then
#strip "xcat" out of the initramfs for kdump
echo "dracut_args --omit \"xcat\"" >> /etc/kdump.conf
fi
#strip the unnecessary kernel options from /proc/cmdline
#the modified "cmdline" will be used as the kernel options
#for kdump initramfs; otherwise, the "service kdump restart" will fail

View File

@@ -2,6 +2,9 @@
BEGIN {
if ((ENVIRON["USEOPENSSLFORXCAT"]) || (ENVIRON["AIX"])) {
server = "openssl s_client -quiet -no_ssl3 -connect " ENVIRON["XCATSERVER"] " -rand /bin/nice 2> /dev/null"
if (!system("openssl s_client -help 2>&1 | grep -m 1 -q -- -no_ssl2")) {
server = "openssl s_client -quiet -no_ssl3 -no_ssl2 -connect " ENVIRON["XCATSERVER"] " -rand /bin/nice 2> /dev/null"
}
} else {
server = "/inet/tcp/0/127.0.0.1/400"
}

View File

@@ -2,6 +2,9 @@
BEGIN {
if (ENVIRON["USEOPENSSLFORXCAT"]) {
server = "openssl s_client -no_ssl3 -connect " ENVIRON["XCATSERVER"] " -rand /bin/nice 2> /dev/null"
if (!system("openssl s_client -help 2>&1 | grep -m 1 -q -- -no_ssl2")) {
server = "openssl s_client -no_ssl3 -no_ssl2 -connect " ENVIRON["XCATSERVER"] " -rand /bin/nice 2> /dev/null"
}
} else {
server = "/inet/tcp/0/127.0.0.1/400"
}

View File

@@ -619,6 +619,36 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do
repo_base="/etc/apt/sources.list.d"
fi
urlrepoindex=0
#add repo for url repos in otherpkgdir
if [ -n "OTHERPKGDIR_INTERNET" ];then
OIFS=$IFS
IFS=','
OTHERPKGDIRLIST_INTERNET=($OTHERPKGDIR_INTERNET)
for url in ${OTHERPKGDIRLIST_INTERNET[@]}
do
if [ $hasyum -eq 1 ] || [ $haszypper -eq 1 ] ; then
REPOFILE="$repo_base/xCAT-otherpkgs$urlrepoindex.repo"
echo "[xcat-otherpkgs$urlrepoindex]" > $REPOFILE
echo "name=xcat-otherpkgs$urlrepoindex" >> $REPOFILE
echo "baseurl=$url" >> $REPOFILE
echo "enabled=1" >> $REPOFILE
echo "gpgcheck=0" >> $REPOFILE
echo "skip_if_unavailable=True" >> $REPOFILE
elif [ $hasapt -eq 1 ] ; then
REPOFILE="$repo_base/xCAT-otherpkgs${urlrepoindex}.list"
echo "deb "$url >> $REPOFILE
fi
urlrepoindex=$[urlrepoindex+1]
done
IFS=$OIFS
fi
array_empty repo_path
repo_pkgs=""
repo_pkgs_preremove=""
@@ -700,10 +730,11 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do
#try to add the path to the repo
if [ $try_repo -eq 1 ]; then
index=$(array_get_size repo_path)
localrepoindex=$[urlrepoindex+index]
if [ $hasyum -eq 1 ] || [ $haszypper -eq 1 ] ; then
REPOFILE="$repo_base/xCAT-otherpkgs$index.repo"
echo "[xcat-otherpkgs$index]" > $REPOFILE
echo "name=xcat-otherpkgs$index" >> $REPOFILE
REPOFILE="$repo_base/xCAT-otherpkgs$localrepoindex.repo"
echo "[xcat-otherpkgs$localrepoindex]" > $REPOFILE
echo "name=xcat-otherpkgs$localrepoindex" >> $REPOFILE
if [ $mounted -eq 0 ]; then
echo "baseurl=http://$whole_path" >> $REPOFILE
else
@@ -711,6 +742,7 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do
fi
echo "enabled=1" >> $REPOFILE
echo "gpgcheck=0" >> $REPOFILE
echo "skip_if_unavailable=True" >> $REPOFILE
if [ $hasyum -eq 1 ]; then
yum clean all
fi
@@ -722,7 +754,7 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do
fi
fi
elif [ $hasapt -eq 1 ] ; then
REPOFILE="$repo_base/xCAT-otherpkgs$index.list"
REPOFILE="$repo_base/xCAT-otherpkgs$localrepoindex.list"
if [ -n "$OTHERPKGDIR" ];then
if [ $mounted -eq 0 ]; then
type=http
@@ -731,16 +763,6 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do
fi
echo "deb $type://$whole_path ./" > $REPOFILE
fi
if [ -n "$OTHERPKGDIR_INTERNET" ] && [ $index -eq 0 ] ;then
OLDIFS=$IFS
IFS=$','
urlarray=($OTHERPKGDIR_INTERNET)
for url in ${urlarray[@]}
do
echo "deb "$url >> $REPOFILE
done
IFS=$OLDIFS
fi
fi
fi
if [ $hasyum -eq 1 ]; then
@@ -798,38 +820,6 @@ EOF`
fi
done
#add repo for url repos in otherpkgdir
if [ -n "OTHERPKGDIR_INTERNET" ];then
OIFS=$IFS
IFS=','
OTHERPKGDIRLIST_INTERNET=($OTHERPKGDIR_INTERNET)
index=$(array_get_size repo_path)
for url in ${OTHERPKGDIRLIST_INTERNET[@]}
do
if [ $hasyum -eq 1 ] || [ $haszypper -eq 1 ] ; then
REPOFILE="$repo_base/xCAT-otherpkgs$index.repo"
echo "[xcat-otherpkgs$index]" > $REPOFILE
echo "name=xcat-otherpkgs$index" >> $REPOFILE
echo "baseurl=$url" >> $REPOFILE
echo "enabled=1" >> $REPOFILE
echo "gpgcheck=0" >> $REPOFILE
index=$[index+1]
fi
done
IFS=$OIFS
if [ $hasyum -eq 1 ]; then
yum clean all
fi
if [ $haszypper -eq 1 ]; then
result=`zypper --non-interactive refresh 2>&1`
if [ $VERBOSE ]; then
echo "otherpkgs: zypper --non-interactive refresh"
echo " $result"
fi
fi
fi
if [ "$repoonly" -eq 1 ]; then
echo "otherpkgs: "repoonly set, so ignore pkg installation ...""

View File

@@ -42,7 +42,7 @@ while read LINE;do
RET=${RET%<*}
[ "$RET" != "0" ] && RETCODE=1
fi
done < <(openssl s_client -no_ssl3 -connect $MASTER_IP:$XCATDPORT -ign_eof -quiet <<<$REQUEST)
done < <(openssl s_client -no_ssl3 $(openssl s_client -help 2>&1 | grep -m 1 -o -- -no_ssl2) -connect $MASTER_IP:$XCATDPORT -ign_eof -quiet <<<$REQUEST)
rm -rf $RESPFILE
exit $RETCODE

View File

@@ -1,7 +1,10 @@
#!/usr/bin/awk -f
BEGIN {
if (ENVIRON["USEOPENSSLFORXCAT"]) {
server = "openssl s_client -no_ssl3 -connect " ENVIRON["XCATSERVER"] " 2> /dev/null"
server = "openssl s_client -no_ssl3 -connect " ENVIRON["XCATSERVER"] " -rand /bin/nice 2> /dev/null"
if (!system("openssl s_client -help 2>&1 | grep -m 1 -q -- -no_ssl2")) {
server = "openssl s_client -no_ssl3 -no_ssl2 -connect " ENVIRON["XCATSERVER"] " -rand /bin/nice 2> /dev/null"
}
} else {
server = "/inet/tcp/0/127.0.0.1/400"
}