X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=kubernetes%2Fconfig%2Fprepull_docker.sh;h=bfd679bf3eea677fc7f5a6f0f4ce1b5ef7d965c6;hb=b4a66f9df15d8b10a31cf531ea6e8bf0bf1dd37a;hp=ef4633419743a833225287b61acaa8200e53e749;hpb=ce1912dcd97fa23a22e31db483de6bef4e06b90b;p=oom.git diff --git a/kubernetes/config/prepull_docker.sh b/kubernetes/config/prepull_docker.sh index ef46334197..bfd679bf3e 100755 --- a/kubernetes/config/prepull_docker.sh +++ b/kubernetes/config/prepull_docker.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh #function to provide help #desc: this function provide help menu @@ -26,9 +26,16 @@ EOF #argument: yaml file #calling syntax: parse_yaml -function parse_yaml { - local prefix=$2 - local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') +parse_yaml () { + local prefix + prefix=$2 + local s + s='[[:space:]]*' + local w + w='[a-zA-Z0-9_]*' + local fs + fs=$(echo @|tr @ '\034') + sed -ne "s|^\($s\):|\1|" \ -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | @@ -102,7 +109,7 @@ do for line in `parse_yaml $filename` do #skiping commented line - if [[ ${line:0:1} != '#' ]]; then + if echo "$line" | grep -v '^#' >/dev/null; then #find all image subtag inside converted values.yaml file's lines if echo $line | grep -q $IMAGE_TEXT ; then #find imageName inside line @@ -110,7 +117,7 @@ do #remove attional prefix and postfix imageNameFinal=`echo "$imageName" | sed -e 's/^"//' -e 's/"$//' ` - #check if line contain Version as a subtag in lines if yes then call docker pull with version + #check if line contain Version as a subtag in lines if yes then call docker pull with version if echo $line | grep -q $IMAGE_VERSION_TEXT ; then echo docker pull "$imageNameWithVersion":"$imageNameFinal" docker pull $imageNameWithVersion:$imageNameFinal &