@@ -40,13 +40,13 @@ cd $TMP_DIR
4040
4141if [ ! -d " $EM_PATH " ] || [ ! -d " $EM_PATH /config/modules" ]
4242then
43- echo " ERROR: cannot open directory $EM_PATH /config/modules. Make sure to change \$ EM_PATH in environment.properties."
43+ echo " ERROR: cannot open directory $EM_PATH /config/modules. Make sure to change EM_PATH in environment.properties."
4444 exit 1
4545fi
4646
4747if [ -z " ${JAVA_HOME} " ] || [ ! -x " ${JAVA_HOME} /bin/jar" ]
4848then
49- echo " ERROR: \$ JAVA_HOME is not set. Please 'export \$ JAVA_HOME=<path to java>'."
49+ echo " ERROR: \$ JAVA_HOME is not set. Please 'export JAVA_HOME=<path to java>'."
5050 exit 1
5151fi
5252
6767 echo " Opening $filename "
6868 " ${JAVA_HOME} /bin/jar" -xf " ${filename} " ManagementModule.xml
6969 mm_name=" "
70- mm_name=" "
7170 alert=" no"
7271
7372 while read p; do
7473 # echo $p
7574
7675 # save Management Module name
7776 [[ -z $mm_name ]] && [[ $p =~ \< Name\> (.* )\< /Name\> ]] && mm_name=" ${BASH_REMATCH[1]} "
77+ # && echo "MM = '$mm_name'"
7878
7979 # find start of alert definition
8080 [[ $p = * " <AlertBase " * ]] && container=" Alert" && container_name=" "
8181
82+ # find start of calculator definition
83+ [[ $p = * " <Calculator " * ]] && container=" Calculator" && container_name=" "
84+
85+ # find start of report element definition
86+ [[ $p = * " <ReportElement " * ]] && container=" ReportElement" && container_name=" "
87+
8288 # find first container name
8389 [[ -n $container ]] && [[ -z $container_name ]] && [[ $p =~ \< Name.* \> (.* )\< /Name\> ]] && container_name=" ${BASH_REMATCH[1]} "
90+ # && echo "found $container $container_name"
8491
8592 # find management module name
8693 [[ -n $element ]] && [[ $p =~ \< ManagementModuleName\> (.* )\< /ManagementModuleName\> ]] && element_mm=" ${BASH_REMATCH[1]} "
97104 # find end of alert
98105 [[ $container = " Alert" ]] && [[ $p =~ \< /AlertBase\> ]] && container=" "
99106
107+ # find end of calculator
108+ [[ $container = " Calculator" ]] && [[ $p =~ \< /Calculator\> ]] && container=" "
109+
110+ # find end of report element
111+ [[ $container = " ReportElement" ]] && [[ $p =~ \< /ReportElement\> ]] && container=" "
112+
100113 # find start of dashboard definition
101114 [[ $p = * " <Dashboard " * ]] && container=" Dashboard" && container_name=" "
102115
116+ # find action
117+ [[ -n $container ]] && [[ $p =~ \< ActionID\> ]] && element=" Action"
118+
119+ # find action
120+ [[ -n $container ]] && [[ $p =~ \< SummaryAlertID\> ]] && element=" Summary Alert"
121+
103122 # find dashboard image
104123 [[ $container = " Dashboard" ]] && [[ $p =~ \< ImageID\> ]] && element=" Image"
105124
106- # find dashboard alert
107- [[ $container = " Dashboard " ]] && [[ $p =~ \< AlertID\> ]] && element=" Alert"
125+ # find alert
126+ [[ -n $container ]] && [[ $p =~ \< AlertID\> ]] && element=" Alert"
108127
109128 # find dashboard link
110129 [[ $container = " Dashboard" ]] && [[ $p =~ \< DashboardID\> ]] && element=" Dashboard Link"
124143 # find end of dashboard
125144 [[ $container = " SmartReportTemplate" ]] && [[ $p =~ \< /SmartReportTemplate\> ]] && container=" "
126145
146+
147+ # if [[ -n $element_name ]]
148+ # then
149+ # if [[ "$mm_name" != "$element_mm" ]]
150+ # then
151+ # echo "found $element ref $element_mm/'$element_name' in $container '$container_name'"
152+ # fi
153+ # fi
154+
127155 # find end of dependency
128156 if [[ -n $container ]] && [[ -n $element ]] &&
129157 [[ " $p " = * " </ActionID>" * ]] || [[ " $p " = * " </ImageID>" * ]] || [[ " $p " = * " </AlertID>" * ]] ||
130158 [[ " $p " = * " </MetricGroupingID>" * ]] || [[ " $p " = * " </DashboardID>" * ]]
131159 then
132160 if [[ " $mm_name " != " $element_mm " ]]
133161 then
134- count=$(( count++ ))
162+ (( ++ count))
163+ # echo "found $element ref $element_mm/'$element_name' in $container '$container_name'"
135164 fi
136165
137166 if [[ $print_all = " 1" ]] || [[ " $mm_name " != " $element_mm " ]]
0 commit comments