2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-27 14:03:25 +00:00
Mauricio Faria de Oliveira 422c3f7fc5 lsf_startup: fix LSF_VERSION expression
When running lsf_startup

	[root@xcat-mn lsf]# updatenode $lsf_master --scripts lsf_startup
	<...>
	p8r1n1: Mon Nov 30 21:30:58 EST 2015 Running postscript: lsf_startup
	p8r1n1: INFO: Run hostsetup on each node.
	p8r1n1: ./lsf_startup: line 48: /usr/share/lsf//install/hostsetup: No such file or directory
	<...>

It is because this expression is broken; no mention to / as field separator.

	# grep '^LSF_VERSION' /install/postscripts/lsf_startup LSF_VERSION=`find /$LSF_TOP -name hostsetup|head -1|awk '{print $5}'`

See:

	[root@p8r1n1 ~]# LSF_TOP="/usr/share/lsf"

	[root@p8r1n1 ~]# find /$LSF_TOP -name hostsetup | head -1
	//usr/share/lsf/9.1/install/hostsetup

	[root@p8r1n1 ~]# find /$LSF_TOP -name hostsetup|head -1|awk '{print $5}'
	[root@p8r1n1 ~]# 

Additionally, it would fail if the version was not exactly the 5th field, which may occur if the user doesn't use /usr/share/lsf for LSF_TOP. And there's even a leading / before $LSF_TOP (ie, /$LSF_TOP).. and what if the user sets LSF_TOP with a trailing / ?

So, lets make this independent of leading slashes and trailing slashes.

	LSF_VERSION="$(find /$LSF_TOP -path "*/install/hostsetup" | grep -o "/[^/]\+/install/hostsetup" | cut -d/ -f2)"

It works on the usual and non-usual cases:

	[root@p8r1n1 ~]# LSF_TOP=/usr/share/lsf
	[root@p8r1n1 ~]# find /$LSF_TOP -path '*/install/hostsetup' | grep -o '/[^/]\+/install/hostsetup' | cut -d/ -f2
	9.1

	[root@p8r1n1 ~]# LSF_TOP=/test/some/other/dir/for/lsf
	[root@p8r1n1 ~]# mkdir -p $LSF_TOP/9.1/install
	[root@p8r1n1 ~]# touch $LSF_TOP/9.1/install/hostsetup
	[root@p8r1n1 ~]# find /$LSF_TOP -path "*/install/hostsetup" | grep -o '/[^/]\+/install/hostsetup' | cut -d/ -f2
	9.1
2015-11-30 22:18:04 -05:00
2015-11-26 08:05:34 -05:00
2015-02-09 19:56:16 -08:00
2015-08-30 07:43:15 +00:00
2015-07-30 01:57:23 -04:00

xCAT - eXtreme Cloud Administration Toolkit

xCAT is a toolkit for the deployment and administration of clusters.

xCAT documentation is available at: http://xcat-docs.readthedocs.org/en/latest/

xCAT is made available as open source software under the EPL license:
http://www.opensource.org/licenses/eclipse-1.0.php


Developers and prospective contributors are encouraged to read the developers
guide: http://xcat-docs.readthedocs.org/en/latest/developers/
and in particular the github related subsection:
http://xcat-docs.readthedocs.org/en/latest/developers/github/
Description
No description provided
Readme EPL-1.0 230 MiB
Languages
Perl 78.6%
Shell 11.3%
JavaScript 7.1%
Python 1.8%
PHP 0.4%
Other 0.4%