X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=kubernetes%2Fconfig%2Fprepull_docker.sh;h=596ace6ad5d7356532c2d7901f0b07da2a0af35e;hb=85b1492555d765b14864e0d2d59db7a50cdccaf0;hp=e456c3e016785d7b9b5f5de5c280cf950b69c05d;hpb=78f8a667c0baf7f9ecb006a0e3c36600c7dbb169;p=oom.git diff --git a/kubernetes/config/prepull_docker.sh b/kubernetes/config/prepull_docker.sh index e456c3e016..596ace6ad5 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,7 +26,7 @@ EOF #argument: yaml file #calling syntax: parse_yaml -function parse_yaml { +parse_yaml () { local prefix=$2 local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') sed -ne "s|^\($s\):|\1|" \ @@ -101,33 +101,32 @@ do #parse yaml files for line in `parse_yaml $filename` do - #find all image subtag inside converted values.yaml file's lines - if echo $line | grep -q $IMAGE_TEXT ; then - #find imageName inside line - imageName=`echo $line | awk -F "=" '{print $2}'` - #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 - if echo $line | grep -q $IMAGE_VERSION_TEXT ; then - echo docker pull "$imageNameWithVersion":"$imageNameFinal" - docker pull $imageNameWithVersion:$imageNameFinal & - imageNameWithVersion=" " - else - #check Version is not in subtag and old scanned value is present then call docker pull without version - if [ "$imageNameWithVersion" != " " ]; then - echo docker pull "$imageNameWithVersion" - docker pull $imageNameWithVersion & - imageNameWithVersion=$imageNameFinal + #skiping commented line + 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 + imageName=`echo $line | awk -F "=" '{print $2}'` + #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 + if echo $line | grep -q $IMAGE_VERSION_TEXT ; then + echo docker pull "$imageNameWithVersion":"$imageNameFinal" + docker pull $imageNameWithVersion:$imageNameFinal & + imageNameWithVersion=" " else - imageNameWithVersion=$imageNameFinal + #check Version is not in subtag and old scanned value is present then call docker pull without version + if [ "$imageNameWithVersion" != " " ]; then + echo docker pull "$imageNameWithVersion" + docker pull $imageNameWithVersion & + imageNameWithVersion=$imageNameFinal + else + imageNameWithVersion=$imageNameFinal + fi fi fi - - fi - - done done # complete processing