Skip to content

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
  • Loading branch information
lohanidamodar committed Oct 20, 2021
1 parent e751a6b commit 086565f
Showing 1 changed file with 0 additions and 77 deletions.
77 changes: 0 additions & 77 deletions scripts/99-image_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -473,81 +473,6 @@ function checkCloudInit {
fi
return 1
}
function checkMongoDB {
# Check if MongoDB is installed
# If it is, verify the version is allowed (non-SSPL)

if [[ $OS == "Ubuntu" ]] || [[ "$OS" =~ Debian.* ]]; then

if [[ -f "/usr/bin/mongod" ]]; then
version=$(/usr/bin/mongod --version --quiet | grep "db version" | sed -e "s/^db\ version\ v//")

if version_gt $version 4.0.0; then
if version_gt $version 4.0.3; then
echo -en "\e[41m[FAIL]\e[0m An SSPL version of MongoDB is present, ${version}"
((FAIL++))
STATUS=2
else
echo -en "\e[32m[PASS]\e[0m The version of MongoDB installed, ${version} is not under the SSPL"
((PASS++))
fi
else
if version_gt $version 3.6.8; then
echo -en "\e[41m[FAIL]\e[0m An SSPL version of MongoDB is present, ${version}"
((FAIL++))
STATUS=2
else
echo -en "\e[32m[PASS]\e[0m The version of MongoDB installed, ${version} is not under the SSPL"
((PASS++))
fi
fi


else
echo -en "\e[32m[PASS]\e[0m MongoDB is not installed"
((PASS++))
fi

elif [[ $OS == "CentOS Linux" ]] || [[ $OS == "CentOS Stream" ]] || [[ $OS == "Rocky Linux" ]]; then

if [[ -f "/usr/bin/mongod" ]]; then
version=$(/usr/bin/mongod --version --quiet | grep "db version" | sed -e "s/^db\ version\ v//")
if version_gt $version 4.0.0; then
if version_gt $version 4.0.3; then
echo -en "\e[41m[FAIL]\e[0m An SSPL version of MongoDB is present"
((FAIL++))
STATUS=2
else
echo -en "\e[32m[PASS]\e[0m The version of MongoDB installed is not under the SSPL"
((PASS++))
fi
else
if version_gt $version 3.6.8; then
echo -en "\e[41m[FAIL]\e[0m An SSPL version of MongoDB is present"
((FAIL++))
STATUS=2
else
echo -en "\e[32m[PASS]\e[0m The version of MongoDB installed is not under the SSPL"
((PASS++))
fi
fi



else
echo -en "\e[32m[PASS]\e[0m MongoDB is not installed"
((PASS++))
fi

else
echo "ERROR: Unable to identify distribution"
((FAIL++))
STATUS 2
return 1
fi


}

function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }

Expand Down Expand Up @@ -663,8 +588,6 @@ checkRoot

checkAgent

checkMongoDB


# Summary
echo -en "\n\n---------------------------------------------------------------------------------------------------\n"
Expand Down

0 comments on commit 086565f

Please sign in to comment.