diff --git a/initial-promises/node-server/failsafe.cf b/initial-promises/node-server/failsafe.cf index 6d4d6fb5f..d6d14cd4c 100644 --- a/initial-promises/node-server/failsafe.cf +++ b/initial-promises/node-server/failsafe.cf @@ -23,7 +23,7 @@ body common control { - bundlesequence => { "check_lock_db_problem", "init_files", "update" }; + bundlesequence => { "init_files", "update" }; inputs => { "common/1.0/update.cf" }; output_prefix => "rudder"; @@ -141,50 +141,6 @@ bundle agent init_files "${sys.workdir}/bin/cf-key"; } -# This bundle will check the "last successful inputs update", and if it is older -# than 1 hour, remove cf_lock.db (and only this DB), to give CFEngine a chance -# to run properly again. -bundle agent check_lock_db_problem{ - vars: - - cfengine_3_0|cfengine_3_1|cfengine_3_2:: - "cf_lock_filename" string => "cf_lock.db"; - - !(cfengine_3_0|cfengine_3_1|cfengine_3_2):: - "cf_lock_filename" string => "cf_lock.tcdb"; - - files: - # The aim of this promise is to create a class when this file is older - # than one hour. The class can not be created without touching but in - # order to not modifing the mtime we use warn_only. - "${sys.workdir}/last_successful_inputs_update" - file_select => over_an_hour, - touch => "true", - action => warn_only, - classes => success("last_successful_inputs_update_too_old", "last_successful_inputs_update_check_error", "last_successful_inputs_update_ok"); - - "${sys.workdir}/state/${cf_lock_filename}" - delete => tidy, - ifvarclass => "last_successful_inputs_update_too_old", - classes => success("cf_lock_removed", "cf_lock_error_removing", "cf_lock_not_deleted"); - - reports: - cf_lock_removed:: - "@@Common@@log_repaired@@hasPolicyServer-root@@common-root@@00@@Update@@None@@${g.execRun}##${g.uuid}@#Promises had not been updated for over an hour, this could indicate a broken lockfile. cf_lock DB file was removed."; - - cf_lock_error_removing:: - "@@Common@@result_error@@hasPolicyServer-root@@common-root@@00@@Update@@None@@${g.execRun}##${g.uuid}@#Promises have not been updated for over an hour, this could indicate a broken lockfile, but an error occured when trying to remove it"; -} - -body file_select over_an_hour() -{ - # Select file which are older than one hour - # Use of positive mtime instead of negative one - # In order to avoid corner effects - mtime => irange(ago(0,0,0,1,0,0), now); - file_result => "!mtime"; -} - body depth_search recurse(d) { depth => "${d}"; diff --git a/techniques/system/common/1.0/failsafe.st b/techniques/system/common/1.0/failsafe.st index 77b9a30e4..d3f8e922c 100644 --- a/techniques/system/common/1.0/failsafe.st +++ b/techniques/system/common/1.0/failsafe.st @@ -22,7 +22,7 @@ body common control { - bundlesequence => { "check_lock_db_problem", "init_files", "update" }; + bundlesequence => { "init_files", "update" }; inputs => { "common/1.0/update.cf" }; output_prefix => "rudder"; @@ -141,49 +141,6 @@ bundle agent init_files "${sys.workdir}/bin/cf-key"; } -# This bundle will check the "last successful inputs update", and if it is older -# than 1 hour, remove cf_lock.db (and only this DB), to give CFEngine a chance -# to run properly again. -bundle agent check_lock_db_problem{ - vars: - - cfengine_3_0|cfengine_3_1|cfengine_3_2:: - "cf_lock_filename" string => "cf_lock.db"; - - !(cfengine_3_0|cfengine_3_1|cfengine_3_2):: - "cf_lock_filename" string => "cf_lock.tcdb"; - - files: - # The aim of this promise is to create a class when this file is older - # than one hour. The class can not be created without touching but in - # order to not modifing the mtime we use WarnOnly. - "${sys.workdir}/last_successful_inputs_update" - file_select => over_an_hour, - touch => "true", - action => WarnOnly, - classes => success("last_successful_inputs_update_too_old", "last_successful_inputs_update_check_error", "last_successful_inputs_update_ok"); - - "${sys.workdir}/state/${cf_lock_filename}" - delete => tidy, - ifvarclass => "last_successful_inputs_update_too_old", - classes => success("cf_lock_removed", "cf_lock_error_removing", "cf_lock_not_deleted"); - - reports: - cf_lock_removed:: - "@@Common@@log_repaired@@&TRACKINGKEY&@@Update@@None@@${g.execRun}##${g.uuid}@#Promises had not been updated for over an hour, this could indicate a broken lockfile. cf_lock DB file was removed."; - - cf_lock_error_removing:: - "@@Common@@result_error@@&TRACKINGKEY&@@Update@@None@@${g.execRun}##${g.uuid}@#Promises have not been updated for over an hour, this could indicate a broken lockfile, but an error occured when trying to remove it"; -} - -body file_select over_an_hour() -{ - # Select file which are older than one hour - # Use of positive mtime instead of negative one - # In order to avoid corner effects - mtime => irange(ago(0,0,0,1,0,0), now); - file_result => "!mtime"; -} body depth_search recurse(d) {