##################################################################
#
# DO NOT EDIT THIS FILE. All policy files prefixed with CFE_ are maintained
# by CFEngine and its original state is required for internal operations of
# CFEngine. If the file has been modified CFEngine's upgrades may require
# manual intervention. Contact CFEngine support if additional information
# and/or recommendation is needed.
#
##################################################################
##################################################################
#
# cfe_internal_management
#  - manage internal CFE functionalities (any:: can be modified)
#  - some agent bundles are in CFE_hub_specific.cf
#
##################################################################
bundle common cfe_internal_management_file_control
# @brief Define policy input dependancies
{
  vars:

      "inputs" slist => { };

    cfengine_recommendations_enabled::
      "input[cfengine_recommendations]"
        string => "$(this.promise_dirname)/recommendations.cf";

    any::
      "inputs" slist => getvalues( input );
}

body file control
# @brief Include policy input dependancies
{
    cfengine_recommendations_enabled::
      inputs => { @(cfe_internal_management_file_control.inputs) };
}

bundle agent cfe_internal_management
# @brief Actuate the appropriate set(s) of internal management policies
{
  vars:
    any::
      "policy[cfe_internal_core_main]"
        string => "cfe_internal_core_main",
        comment => "Activate policies related to basic CFEngine operations";

    enterprise_edition::
      "policy[cfe_internal_enterprise_main]"
        string => "cfe_internal_enterprise_main",
        comment => "Activate policies related to CFEngine Enterprise operations";

    # TODO: Scope this more tightly to mission portal role
    enterprise_edition.policy_server::
      "policy[cfe_internal_enterprise_mission_portal]"
        string => "Activate policies related to CFEngine Enterprise Mission Portal";

    any::
      "bundles" slist => getindices(policy);

      "recommendation_bundles"
        slist => sort( bundlesmatching( ".*", "cfengine_recommends" ), lex);

  methods:

      #
      # CFEngine internals
      #

      "CFEngine_Internals"
        usebundle => "$(bundles)";

      "CFEngine Recommendations"
        usebundle => $(recommendation_bundles),
        if => isvariable( recommendation_bundles );

  reports:
    DEBUG|DEBUG_cfe_internal_management::
      "DEBUG $(this.bundle): Should actuate $(bundles)";

    cfengine_recommendation_instruct_disablement::
      "Note: All recommendations can be disabled by defining 'default:cfengine_recommendations_disabled'";
}
