whitespace cleanup on functions & lib/config
fix some of the bash8 issues found in functions and lib/config, part of the long march towards fixing all the bash8 issues. Change-Id: Ia131f64870acb0f9d196fe1a9a45d633abb6fc4d
This commit is contained in:
parent
8d3beb673c
commit
537d4025c5
50
functions
50
functions
@ -1372,9 +1372,9 @@ function upload_image() {
|
|||||||
IMAGE="$FILES/${IMAGE_FNAME}"
|
IMAGE="$FILES/${IMAGE_FNAME}"
|
||||||
IMAGE_NAME="${IMAGE_FNAME%.xen-raw.tgz}"
|
IMAGE_NAME="${IMAGE_FNAME%.xen-raw.tgz}"
|
||||||
glance \
|
glance \
|
||||||
--os-auth-token $token \
|
--os-auth-token $token \
|
||||||
--os-image-url http://$GLANCE_HOSTPORT \
|
--os-image-url http://$GLANCE_HOSTPORT \
|
||||||
image-create \
|
image-create \
|
||||||
--name "$IMAGE_NAME" --is-public=True \
|
--name "$IMAGE_NAME" --is-public=True \
|
||||||
--container-format=tgz --disk-format=raw \
|
--container-format=tgz --disk-format=raw \
|
||||||
--property vm_mode=xen < "${IMAGE}"
|
--property vm_mode=xen < "${IMAGE}"
|
||||||
@ -1397,11 +1397,11 @@ function upload_image() {
|
|||||||
mkdir "$xdir"
|
mkdir "$xdir"
|
||||||
tar -zxf $FILES/$IMAGE_FNAME -C "$xdir"
|
tar -zxf $FILES/$IMAGE_FNAME -C "$xdir"
|
||||||
KERNEL=$(for f in "$xdir/"*-vmlinuz* "$xdir/"aki-*/image; do
|
KERNEL=$(for f in "$xdir/"*-vmlinuz* "$xdir/"aki-*/image; do
|
||||||
[ -f "$f" ] && echo "$f" && break; done; true)
|
[ -f "$f" ] && echo "$f" && break; done; true)
|
||||||
RAMDISK=$(for f in "$xdir/"*-initrd* "$xdir/"ari-*/image; do
|
RAMDISK=$(for f in "$xdir/"*-initrd* "$xdir/"ari-*/image; do
|
||||||
[ -f "$f" ] && echo "$f" && break; done; true)
|
[ -f "$f" ] && echo "$f" && break; done; true)
|
||||||
IMAGE=$(for f in "$xdir/"*.img "$xdir/"ami-*/image; do
|
IMAGE=$(for f in "$xdir/"*.img "$xdir/"ami-*/image; do
|
||||||
[ -f "$f" ] && echo "$f" && break; done; true)
|
[ -f "$f" ] && echo "$f" && break; done; true)
|
||||||
if [[ -z "$IMAGE_NAME" ]]; then
|
if [[ -z "$IMAGE_NAME" ]]; then
|
||||||
IMAGE_NAME=$(basename "$IMAGE" ".img")
|
IMAGE_NAME=$(basename "$IMAGE" ".img")
|
||||||
fi
|
fi
|
||||||
@ -1692,23 +1692,23 @@ function check_path_perm_sanity() {
|
|||||||
#
|
#
|
||||||
# _vercmp_r sep ver1 ver2
|
# _vercmp_r sep ver1 ver2
|
||||||
function _vercmp_r {
|
function _vercmp_r {
|
||||||
typeset sep
|
typeset sep
|
||||||
typeset -a ver1=() ver2=()
|
typeset -a ver1=() ver2=()
|
||||||
sep=$1; shift
|
sep=$1; shift
|
||||||
ver1=("${@:1:sep}")
|
ver1=("${@:1:sep}")
|
||||||
ver2=("${@:sep+1}")
|
ver2=("${@:sep+1}")
|
||||||
|
|
||||||
if ((ver1 > ver2)); then
|
if ((ver1 > ver2)); then
|
||||||
echo 1; return 0
|
echo 1; return 0
|
||||||
elif ((ver2 > ver1)); then
|
elif ((ver2 > ver1)); then
|
||||||
echo -1; return 0
|
echo -1; return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ((sep <= 1)); then
|
if ((sep <= 1)); then
|
||||||
echo 0; return 0
|
echo 0; return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_vercmp_r $((sep-1)) "${ver1[@]:1}" "${ver2[@]:1}"
|
_vercmp_r $((sep-1)) "${ver1[@]:1}" "${ver2[@]:1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1730,13 +1730,13 @@ function _vercmp_r {
|
|||||||
#
|
#
|
||||||
# vercmp_numbers ver1 ver2
|
# vercmp_numbers ver1 ver2
|
||||||
vercmp_numbers() {
|
vercmp_numbers() {
|
||||||
typeset v1=$1 v2=$2 sep
|
typeset v1=$1 v2=$2 sep
|
||||||
typeset -a ver1 ver2
|
typeset -a ver1 ver2
|
||||||
|
|
||||||
IFS=. read -ra ver1 <<< "$v1"
|
IFS=. read -ra ver1 <<< "$v1"
|
||||||
IFS=. read -ra ver2 <<< "$v2"
|
IFS=. read -ra ver2 <<< "$v2"
|
||||||
|
|
||||||
_vercmp_r "${#ver1[@]}" "${ver1[@]}" "${ver2[@]}"
|
_vercmp_r "${#ver1[@]}" "${ver1[@]}" "${ver2[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
14
lib/config
14
lib/config
@ -10,7 +10,7 @@
|
|||||||
# [[group-name|file-name]]
|
# [[group-name|file-name]]
|
||||||
#
|
#
|
||||||
# group-name refers to the group of configuration file changes to be processed
|
# group-name refers to the group of configuration file changes to be processed
|
||||||
# at a particular time. These are called phases in ``stack.sh`` but
|
# at a particular time. These are called phases in ``stack.sh`` but
|
||||||
# group here as these functions are not DevStack-specific.
|
# group here as these functions are not DevStack-specific.
|
||||||
#
|
#
|
||||||
# file-name is the destination of the config file
|
# file-name is the destination of the config file
|
||||||
@ -64,12 +64,12 @@ function get_meta_section_files() {
|
|||||||
[[ -r $file ]] || return 0
|
[[ -r $file ]] || return 0
|
||||||
|
|
||||||
$CONFIG_AWK_CMD -v matchgroup=$matchgroup '
|
$CONFIG_AWK_CMD -v matchgroup=$matchgroup '
|
||||||
/^\[\[.+\|.*\]\]/ {
|
/^\[\[.+\|.*\]\]/ {
|
||||||
gsub("[][]", "", $1);
|
gsub("[][]", "", $1);
|
||||||
split($1, a, "|");
|
split($1, a, "|");
|
||||||
if (a[1] == matchgroup)
|
if (a[1] == matchgroup)
|
||||||
print a[2]
|
print a[2]
|
||||||
}
|
}
|
||||||
' $file
|
' $file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user