Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions masterfiles/failsafe.cf
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ bundle agent update
"$(inputs_dir)/cf_promises_validated"
comment => "Check whether a validation stamp is available for a new policy update to reduce the distributed load",
handle => "check_valid_update",
copy_from => u_dcp("$(master_location)/cf_promises_validated","$(sys.policy_hub)"),
copy_from => u_rcp("$(master_location)/cf_promises_validated","$(sys.policy_hub)"),
action => u_immediate,
classes => u_if_repaired("validated_updates_ready");

Expand Down Expand Up @@ -200,19 +200,6 @@ body copy_from u_rcp(from,server)

#########################################################

body copy_from u_dcp(from,server)
{
source => "$(from)";
compare => "mtime";
trustkey => "true";

!am_policy_hub::

servers => { "$(server)" };
}

#########################################################

body copy_from u_cp_nobck(from)
{
source => "$(from)";
Expand Down
13 changes: 8 additions & 5 deletions src/bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,17 @@ void SetPolicyServer(char *name)
snprintf(file, CF_MAXVARSIZE, "%s/masterfiles/cf_promises_validated", CFWORKDIR);
MapName(file);

if ((fin = fopen(file, "r")) == NULL)
struct stat sb;

if ((cfstat(file, &sb)) != 0)
{
return;
}

fscanf(fin, "%255[^\n]", fileContents);
NewScalar("sys", "last_policy_update", fileContents, cf_str);
fclose(fin);

char timebuf[26];
cf_strtimestamp_local(sb.st_mtime, timebuf);

NewScalar("sys", "last_policy_update", timebuf, cf_str);
}

/********************************************************************/
Expand Down
4 changes: 3 additions & 1 deletion src/generic_agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@ int CheckPromises(enum cfagenttype ag)
FILE *fp = fdopen(fd, "w");
time_t now = time(NULL);

fprintf(fp, "%s", ctime(&now));
char timebuf[26];

fprintf(fp, "%s", cf_strtimestamp_local(now, timebuf));
fclose(fp);
CfOut(cf_verbose, "", " -> Caching the state of validation\n");
}
Expand Down