#!/bin/sh
# SHLINT:yes
#####################################################################
# copyright (C) 2017 by NetApp.  All Rights Reserved.
#
#####################################################################

#prog_name="netapp_nodar_build_check"

#Do not run this script if target build is DARE.
#
target_build_file=$1
if ! (grep 'TYPE:.\+NODAR' ${target_build_file} >/dev/null) ; then
    exit 0
fi

#Check whether there are any VGE volumes in the cluster.
#
vol_cmd="set diag; debug smdb table volume show -is-encrypted true -fields is-encrypted"
vol_cmd_output=$(ngsh -c \"${vol_cmd}\")
echo "$vol_cmd_output" | grep "There are no entries matching your query." > /dev/null
vol_cmd_res=$?
if [ $vol_cmd_res == 0 ]; then
#"No Encrypted Volumes and script passed";
    exit 0
else
#"Encrypted Volumes present and script failed. do error out"
    exit 1
fi
