Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Compute list and summary of security contacts
Tom Scavo committed May 6, 2017
1 parent 1ce8524 commit 9c90d14
Showing 1 changed file with 68 additions and 17 deletions.
85 changes: 68 additions & 17 deletions bin/process_main_aggregate.sh
@@ -25,9 +25,12 @@ display_help () {
This script produces the following files from the InCommon
main aggregate:
$csv_filename1
$csv_filename2
$csv_filename3
$out_filename1
$out_filename2
$out_filename3
$out_filename4
$out_filename5
$out_filename6
The script is intended to be run as a cron job. It can (and
should) be run often, to pick up the latest changes to metadata.
@@ -109,9 +112,12 @@ if [ -z "$LOG_LEVEL" ]; then
fi

# output filenames
csv_filename1="all-idp-displaynames.csv"
csv_filename2="all-idps-rands.csv"
csv_filename3="all-sps-rands.csv"
out_filename1="all-idp-displaynames.csv"
out_filename2="all-idps-rands.csv"
out_filename3="all-sps-rands.csv"
out_filename4="security-contacts-legacy-list.csv"
out_filename5="security-contacts-summary.json"
out_filename6="security-contacts-summary-local.json"

#######################################################################
# Process command-line options and arguments
@@ -199,6 +205,21 @@ if [ ! -f "$xsl_file3" ]; then
echo "ERROR: $script_name: lib file does not exist: $xsl_file3" >&2
exit 2
fi
xsl_file4=$LIB_DIR/security_contacts_legacy_list_csv.xsl
if [ ! -f "$xsl_file4" ]; then
echo "ERROR: $script_name: lib file does not exist: $xsl_file4" >&2
exit 2
fi
xsl_file5=$LIB_DIR/security_contacts_summary_json.xsl
if [ ! -f "$xsl_file5" ]; then
echo "ERROR: $script_name: lib file does not exist: $xsl_file5" >&2
exit 2
fi
xsl_file6=$LIB_DIR/security_contacts_summary_local_json.xsl
if [ ! -f "$xsl_file6" ]; then
echo "ERROR: $script_name: lib file does not exist: $xsl_file6" >&2
exit 2
fi

# create a temporary subdirectory
tmp_dir="${TMPDIR%%/}/${script_name%%.*}_$$"
@@ -213,9 +234,12 @@ fi
xml_file="${tmp_dir}/saml-metadata.xml"

# output files
csv_file1="${tmp_dir}/$csv_filename1"
csv_file2="${tmp_dir}/$csv_filename2"
csv_file3="${tmp_dir}/$csv_filename3"
out_file1="${tmp_dir}/$out_filename1"
out_file2="${tmp_dir}/$out_filename2"
out_file3="${tmp_dir}/$out_filename3"
out_file4="${tmp_dir}/$out_filename4"
out_file5="${tmp_dir}/$out_filename5"
out_file6="${tmp_dir}/$out_filename6"

#######################################################################
# Main processing
@@ -242,35 +266,62 @@ if [ $exit_code -gt 1 ]; then
fi

# create the first output file
print_log_message -D "$script_name writing output file: $csv_file1"
/usr/bin/xsltproc $xsl_file1 $xml_file > $csv_file1
print_log_message -I "$script_name writing output file: $out_filename1"
/usr/bin/xsltproc $xsl_file1 $xml_file > $out_file1
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: $xsl_file1"
clean_up_and_exit -d "$tmp_dir" $exit_code
fi

# create the second output file
print_log_message -D "$script_name writing output file: $csv_file2"
/usr/bin/xsltproc $xsl_file2 $xml_file > $csv_file2
print_log_message -I "$script_name writing output file: $out_filename2"
/usr/bin/xsltproc $xsl_file2 $xml_file > $out_file2
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: $xsl_file2"
clean_up_and_exit -d "$tmp_dir" $exit_code
fi

# create the third output file
print_log_message -D "$script_name writing output file: $csv_file3"
/usr/bin/xsltproc $xsl_file3 $xml_file > $csv_file3
print_log_message -I "$script_name writing output file: $out_filename3"
/usr/bin/xsltproc $xsl_file3 $xml_file > $out_file3
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: $xsl_file3"
clean_up_and_exit -d "$tmp_dir" $exit_code
fi

# create the fourth output file
print_log_message -I "$script_name writing output file: $out_filename4"
/usr/bin/xsltproc $xsl_file4 $xml_file > $out_file4
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: $xsl_file4"
clean_up_and_exit -d "$tmp_dir" $exit_code
fi

# create the fifth output file
print_log_message -I "$script_name writing output file: $out_filename5"
/usr/bin/xsltproc $xsl_file5 $xml_file > $out_file5
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: $xsl_file5"
clean_up_and_exit -d "$tmp_dir" $exit_code
fi

# create the sixth output file
print_log_message -I "$script_name writing output file: $out_filename6"
/usr/bin/xsltproc $xsl_file6 $xml_file > $out_file6
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: xsltproc failed ($exit_code) on stylesheet: $xsl_file6"
clean_up_and_exit -d "$tmp_dir" $exit_code
fi

# move the output files to the web directory
print_log_message -D "$script_name moving output files to dir: $out_dir"
/bin/mv $csv_file1 $csv_file2 $csv_file3 $out_dir
print_log_message -I "$script_name moving output files to dir: $out_dir"
/bin/mv $out_file1 $out_file2 $out_file3 $out_file4 $out_file5 $out_file6 $out_dir
exit_code=$?
if [ $exit_code -ne 0 ]; then
print_log_message -E "$script_name: mv failed ($exit_code) to dir: $out_dir"

0 comments on commit 9c90d14

Please sign in to comment.