Skip to content

Commit

Permalink
agents: also save backup if defaults can be updated
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Nov 14, 2024
1 parent e207f92 commit 60dd1e2
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,11 @@ sub _check_inventory {
}
}
if(scalar @need_update > 0) {
# save inventory backup
my $invfile = $c->config->{'var_path'}.'/agents/hosts/'.$hostname.'.json';
my $savfile = $invfile.'.chk';
copy($invfile, $savfile) && _debug("saved copy of inventory to %s", $savfile);

return(sprintf("WARNING - %s check%s could re-apply defaults. |%s\n( run command: thruk agents -II '%s' )\nservices:\n%s\n",
scalar @need_update,
(scalar @need_update != 1 ? 's' : ''),
Expand Down

0 comments on commit 60dd1e2

Please sign in to comment.