3 ##############################################################################
5 ### generate-application-config-insert-cql.sh
7 ### A script that generates the CQL commands to INSERT validation schemas to the application_config table.
8 ### We keep the schemas FTL files under a folder - this folder will be parsed and INSERT commands will be created.
10 ### If the path is 'schemaTemplates/composition/myFile.ftl' the result KEY will be: composition.myFile .
14 ### ./generate-application-config-insert-cql.sh <namespace> <schemas-folder>
18 ### Version 1.0 for OPENECOMP
21 ##############################################################################
25 APP_CONFIG_TABLE='application_config'
27 #### Functions - Start ####
28 usage() { echo "Usage: $0 <namespace> <schemaTemplates-folder>, for example: $0 vsp.schemaTemplates schemaTemplates/" 1>&2; exit 1; }
42 for fileName in $(find ${path} -type f)
44 value=$(getFileContent ${fileName})
45 onlyFilename=$(basename $fileName)
46 name="${onlyFilename%.*}"
47 tempPath=$(dirname $fileName)
48 keyColumn=$(basename $tempPath).$name
49 echo "INSERT INTO $APP_CONFIG_TABLE (namespace,key,value) VALUES ('$namespace', '$keyColumn', '$value');"
56 #### Functions - End ####
59 if [ "$#" -lt 2 ] || [ "$#" -gt 2 ]; then