file bodies

control

Prototype: control

Description: Include policy needed for updating masterfiles, the default policy distribution point with content from an upstream VCS

Implementation:

code
body file control
{
      inputs => { @(cfe_internal_update_from_repository_file_control.inputs) };
}

common bodies

cfe_internal_update_from_repository_file_control

Prototype: cfe_internal_update_from_repository_file_control

Description: Define inputs needed for updating masterfiles, the default policy distribution point with content from an upstream VCS

Implementation:

code
bundle common cfe_internal_update_from_repository_file_control
{
  vars:
      "inputs" slist => { "$(this.promise_dirname)/lib.cf" };
}

agent bundles

cfe_internal_update_from_repository

Prototype: cfe_internal_update_from_repository

Description: Ensure masterfiles, the default policy is up to date

Implementation:

code
bundle agent cfe_internal_update_from_repository
{
  methods:
    am_policy_hub.cfengine_internal_masterfiles_update::
      "Update staged masterfiles from VCS"
        usebundle => cfe_internal_masterfiles_stage,
        handle => "cfe_internal_update_from_repository_methods_masterfiles_fetch",
        action => u_immediate,
        comment => "Grab the latest updates from upstream VCS repo before deploying masterfiles";

}

cfe_internal_masterfiles_stage

Prototype: cfe_internal_masterfiles_stage

Description: Run masterfiles-stage.sh to update the default distribution of masterfiles

Implementation:

code
bundle agent cfe_internal_masterfiles_stage
{

  commands:
      "$(update_def.dc_scripts)/masterfiles-stage.sh"
        classes => u_kept_successful_command_results("bundle", "masterfiles_deploy"),
        handle => "masterfiles_update_stage",
        action => u_immediate;

  reports:
    masterfiles_deploy_not_kept::
      "Masterfiles deployment failed, for more info see '$(sys.workdir)/outputs/dc-scripts.log'";

    (DEBUG|DEBUG_cfe_internal_masterfiles_stage).(masterfiles_deploy_kept|masterfiles_deploy_repaired)::
      "DEBUG $(this.bundle): Masterfiles deployed successfully";
}