Skip to content

Commit

Permalink
Fixes #8871: missing rudder_expected_reports.csv.res when starting th…
Browse files Browse the repository at this point in the history
…e agent for the first time after an update
  • Loading branch information
amousset committed Aug 29, 2016
1 parent c1aed27 commit 9f55b99
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions tree/30_generic_methods/logger_rudder.cf
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ bundle agent logger_rudder(message, class_prefix)
vars:

"expected_reports_source" string => "${sys.workdir}/inputs/rudder_expected_reports.csv";
"expected_reports_temp" string => "${expected_reports_source}.tmp";
"expected_reports_file" string => "${expected_reports_source}.res";
"expected_reports_destination" string => "${sys.workdir}/state/rudder_expected_reports.${this.promiser_pid}.csv";
# We put those files into the state directory to avoid purging them during each update
# (whoch would break the current run's reporting).
# We add the PID to the file name to be able to handle cuncurrent agent runs with separate expected reports
"expected_reports_temp" string => "${expected_reports_destination}.tmp";
"expected_reports_file" string => "${expected_reports_destination}.res";

pass1.(!final_resfile_exists.logger_rudder_temp_resfile_reached|logger_rudder_temp_resfile_repaired)::
# 2/ If the temporary file has been updated, read it to get all values in an array, and canonify the first entry
Expand Down Expand Up @@ -94,6 +98,32 @@ bundle agent logger_rudder(message, class_prefix)

}

# This bundle will delete the current expected reports file
# It is supposed to be called at the end of the run
bundle agent _clean_current_expected_reports_file {

vars:
"files_to_remove" slist => { "${logger_rudder.expected_reports_temp}",
"${logger_rudder.expected_reports_file}" }

files:
"${files_to_remove}"
delete => tidy;

}

# This bundle will delete expected reports files older than the given age
# It allows cleaning leftovers from interrupted executions
bundle agent _clean_old_expected_reports_file(days) {

files:
"${sys.workdir}/state/rudder_expected_reports.*.csv.res"

delete => tidy,
file_select => days_old("${days}");

}

# bundle backported from rudder (prefixed with _ to avoid conflicts)
# all this whould be removed when we put this file back to rudder
#
Expand Down

0 comments on commit 9f55b99

Please sign in to comment.