file
First seen , last seen .
service_config.cf (4d9320d24e1c4d3b26cbe4ee0d861db992a1b0daa1d10743071de5a3d5771954)
See also: service_config.cf (filename)
The file service_config.cf (2.4 kB), identified by its SHA-256 checksum. This file is found on 100 hosts in your infrastructure, at 3 different paths.
2.4 kB, 72 lines, CFEngine policy:
# - service_started_file - a file which should have the timestamp of when the service was last started, typically a pid file or maybe /proc/<pid> directory. # todo, maybe chmod, user, group for config_final_path bundle agent service_config( service_name, config_template_path, config_final_path, validate_config_command, template_data, service_started_file ) { vars: "staged_config" string => "$(config_final_path).staged"; methods: "staged config rendered" usebundle => file_make_mustache($(staged_config), $(config_template_path), @(template_data)); "final config and restart" usebundle => validate_config_and_restart_service($(staged_config), $(validate_config_command), $(config_final_path), $(service_name), $(service_started_file)); reports: DEBUG:: "template_data is ${with}" with => storejson(template_data); } bundle agent validate_config_and_restart_service( staged_config, validate_config_command, config_final_path, service_name, service_started_file) { vars: "validation_output" string => "$(staged_config)-validation.log"; classes: "config_validated" expression => returnszero("$(validate_config_command) $(staged_config) >$(validation_output) 2>&1", "useshell"); "config_final_exists" expression => fileexists("$(config_final_path)"); "config_newer_than_started_file" expression => isnewerthan("$(config_final_path)", "$(service_started_file)"), if => canonify("$(service_name)_config_ok"); files: "$(config_final_path)" copy_from => local_dcp($(staged_config)), if => "config_validated", classes => scoped_classes_generic("bundle", "$(service_name)_config"); services: "$(service_name)" service_policy => "restart", if => and("config_validated", or(not("config_final_exists"), "config_newer_than_started_file")); reports: DEBUG:: "service_started_file is $(service_started_file)"; "$(staged_config) validated" if => "config_validated"; "$(config_final_path) exists" if => "config_final_exists"; "$(config_final_path) is newer than service started file $(service_started_file)" if => "config_newer_than_started_file"; !config_validated:: "validation output ${with}" with => readfile("${validation_output}"); }