diff options
Diffstat (limited to 'aai-traversal/src/main/scripts')
-rw-r--r-- | aai-traversal/src/main/scripts/deleteNamedQuery.sh | 62 | ||||
-rw-r--r-- | aai-traversal/src/main/scripts/getTool.sh | 4 | ||||
-rw-r--r-- | aai-traversal/src/main/scripts/install/siteconf.pl | 100 |
3 files changed, 65 insertions, 101 deletions
diff --git a/aai-traversal/src/main/scripts/deleteNamedQuery.sh b/aai-traversal/src/main/scripts/deleteNamedQuery.sh new file mode 100644 index 0000000..70faddf --- /dev/null +++ b/aai-traversal/src/main/scripts/deleteNamedQuery.sh @@ -0,0 +1,62 @@ +#!/bin/ksh + +### +# ============LICENSE_START======================================================= +# org.openecomp.aai +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +# +# This script deletes the named query in bundleconfig/etc/scriptdata/named-query-json directory +# + +PROGNAME=$(basename $0) +OUTFILE=$PROJECT_HOME/logs/misc/${PROGNAME}.log.$(date +\%Y-\%m-\%d) +#OUTFILE=/c/temp/${PROGNAME}.log.$(date +\%Y-\%m-\%d) + +TS=$(date "+%Y-%m-%d %H:%M:%S") + +CHECK_USER="aaiadmin" +userid=$( id | cut -f2 -d"(" | cut -f1 -d")" ) +if [ "${userid}" != $CHECK_USER ]; then + echo "You must be $CHECK_USER to run $0. The id used $userid." + exit 1 +fi + +error_exit () { + echo "${PROGNAME}: failed for ${1:-"Unknown error"} on cmd $2" 1>&2 + echo "${PROGNAME}: failed for ${1:-"Unknown error"} on cmd $2" >> $OUTFILE +# exit ${2:-"1"} +} + +j=0 +for filepath in `ls $PROJECT_HOME/bundleconfig/etc/scriptdata/named-query-json/*.json|sort -f` +#for filepath in `ls /c/sources/aai/aaigitnew/bundleconfig-local/etc/scriptdata/named-query-json/*.json|sort -f` +do +j=$(expr "$j" + 1) +filename=$(basename $filepath) +echo "Begin deleteTool for named-query $filename" | tee -a $OUTFILE +vers=`grep named-query-uuid $filepath|cut -d':' -f2|cut -d'"' -f2` +resource=service-design-and-creation/named-queries/named-query/$vers +echo "y" | $PROJECT_HOME/scripts/deleteTool.sh $resource >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j +echo "End deleteTool for named-query $filename" | tee -a $OUTFILE +done + +echo "$PROGNAME completed ${TS}" | tee -a $OUTFILE +echo "See output and error file: $OUTFILE" + +exit 0 diff --git a/aai-traversal/src/main/scripts/getTool.sh b/aai-traversal/src/main/scripts/getTool.sh index c11bad3..38f96c5 100644 --- a/aai-traversal/src/main/scripts/getTool.sh +++ b/aai-traversal/src/main/scripts/getTool.sh @@ -9,7 +9,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/aai-traversal/src/main/scripts/install/siteconf.pl b/aai-traversal/src/main/scripts/install/siteconf.pl deleted file mode 100644 index d035851..0000000 --- a/aai-traversal/src/main/scripts/install/siteconf.pl +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/perl -# CC_ID_SITECONF_PL[] = "@(#)/vobs/waas/src/oam/siteconf.pl@@/main/4" - -#.Description -# This perl script takes as input template file, -# and one or more configuration files. It uses the values in the -# configuration files as substitutions for the matching tags in the template -# file. - -#.Constraints -# The input files must be readable by the script. - -#.See Also -# - -use Getopt::Std; - -local $dbg=0; - -getopts ('dt:c:'); - -if ($opt_d) { - $dbg=$opt_d; -} - -if ($dbg) { - print STDERR "opt_d=$opt_d\n"; - print STDERR "opt_t=$opt_t\n"; - print STDERR "opt_c=$opt_c\n"; -} - -### -# Print usage if no arguments passed -if (! $opt_t) { - print STDERR "Usage: $0 -t templatefile -c configfilelist\n"; - exit (1); -} - -# process the template file variable -if ($opt_t) { - if (! -r $opt_t) { - print STDERR "Error: Can't read template file $opt_t\n"; - exit (2); - } - $templatefile = $opt_t; -} -else { - print STDERR "Error: You must enter the template file name\n"; - exit (2); -} - -### -# Global error flag for return code when exiting -$err = 0; - -$configlist = ''; -if ($opt_c) { - $configlist = $opt_c; -} - -# process the site configuration file variable -if ($configlist) { - @siteary = split /,/, $configlist; -} - -# Add PROJECT_HOME to Conf dictionary -$Conf{'PROJECT_HOME'} = $ENV{'PROJECT_HOME'}; - -foreach $arg (@siteary) { - if ($dbg) { print STDERR "Opening $arg\n" } - - open(CONF, $arg) || die $!, ", '$arg'\n"; - - while (<CONF>) { - #1 while chomp(); - $_ =~ s/[\r\n]$//g; # strip newlines and dos-injected carriage returns - if ( /=/ ) { - ($attr,$value) = split(/=/,$_,2); - $value =~ s/\$PHOME/$ENV{'PROJECT_HOME'}/; - $value =~ s/\$PROJECT_HOME/$ENV{'PROJECT_HOME'}/; - $Conf{$attr} = $value; - } - } - - close CONF; -} - -if ($dbg) { print STDERR "Expanding $templatefile\n" } - -# Expand a config file - -open(TEMPLATE, $templatefile) || die $!, ", '$templatefile'\n"; -while (<TEMPLATE>) { - # handle strings such as @HTTP_ROOT@@HTTP_PORT@ - s/@(\w+)@/$Conf{$1}/g; - print; -} - -close TEMPLATE; - |