Fix get_column_num problem in heat-keystone-setup

get_column_num function searches the second line of command output,
to get the field number for a specific field.

But output of 'keystone user-list' may have an extra line: 'WARNING:
Bypassing authentication using a token & endpoint ...'

This messes up the functionality of get_column_num function

Closes-bug: #1260556
Change-Id: I8c6e7f939466154c5e31e6f019e20fb855e15878
This commit is contained in:
DennyZhang 2013-12-12 19:16:43 -06:00
parent 582cf8f047
commit 19948b1561
1 changed files with 1 additions and 1 deletions

View File

@ -47,7 +47,7 @@ get_id () {
get_column_num() {
local name=$1
shift
$@ | awk -F'|' "NR == 2 { for (i=2; i<NF; i++) if (\$i ~ \"^ *${name} *\$\") print (i - 1) }"
$@ | awk -F'|' "NR == 2 && /^|/ { for (i=2; i<NF; i++) if (\$i ~ \"^ *${name} *\$\") print (i - 1) }"
}
get_user() {