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
20 changes: 20 additions & 0 deletions .github/workflows/cfengine_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint policy with CFEngine CLI
on:
workflow_call:
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-24.04
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Checkout masterfiles
uses: actions/checkout@v4
- name: Install CFEngine CLI
run: pipx install cfengine
- name: Run cfengine lint
run: |
cfengine lint --strict no ./
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ on:
jobs:
style_check:
uses: ./.github/workflows/style_check.yml
cfengine_lint:
uses: ./.github/workflows/cfengine_lint.yml
bootstrap_policy_run_check:
needs: style_check
needs: [style_check, cfengine_lint]
uses: ./.github/workflows/bootstrap_policy_run_check.yml
tests:
needs: bootstrap_policy_run_check
Expand Down
2 changes: 1 addition & 1 deletion cfbs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Masterfiles",
"name": "masterfiles",
"description": "Official CFEngine Masterfiles Policy Framework (MPF)",
"type": "module",
"provides": {
Expand Down
26 changes: 10 additions & 16 deletions cfe_internal/CFE_cfengine.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,21 @@ bundle common cfe_internal_management_file_control
# @brief Define policy input dependancies
{
vars:

"inputs" slist => { };
"inputs" slist => {};

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

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

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

bundle agent cfe_internal_management
Expand All @@ -59,20 +58,15 @@ bundle agent cfe_internal_management
"bundles" slist => getindices(policy);

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

methods:
# CFEngine internals
"CFEngine_Internals" usebundle => "$(bundles)";

#
# CFEngine internals
#

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

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

reports:
DEBUG|DEBUG_cfe_internal_management::
Expand Down
4 changes: 2 additions & 2 deletions cfe_internal/enterprise/CFE_hub_specific.cf
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ bundle agent log_cfengine_enterprise_license_utilization

}

bundle agent cfe_internal_enterprise_HA_classes
bundle agent cfe_internal_enterprise_ha_classes
{
classes:
# NOTE The `hub_active` class is a hard class defined by the ha_plugin in
Expand Down Expand Up @@ -645,7 +645,7 @@ bundle agent cfe_internal_enterprise_maintenance

enterprise_edition::
"HA classes"
usebundle => "cfe_internal_enterprise_HA_classes",
usebundle => "cfe_internal_enterprise_ha_classes",
comment => "Set the HA-related classes for the maintenance bundles";

"Enterprise Maintenance"
Expand Down
4 changes: 2 additions & 2 deletions cfe_internal/enterprise/federation/federation.cf
Original file line number Diff line number Diff line change
Expand Up @@ -809,9 +809,9 @@ bundle agent ensure_feeders
arglist => {
"cfdb",
@if minimum_version(3.24)
"select ensure_feeders($(feeders_arg));"
"select ensure_feeders($(feeders_arg));",
@else
`"select ensure_feeders($(feeders_arg));"`
`"select ensure_feeders($(feeders_arg));"`,
@endif
},
classes => psql_wrapper_exit_codes,
Expand Down
23 changes: 10 additions & 13 deletions cfe_internal/enterprise/ha/ha_info.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
"192.168.100.10":
{
"sha": "PLACE KEY HERE",
"internal_ip": "192.168.100.10",
"is_in_cluster" : true,
},
"192.168.100.11":
{
"sha": "PLACE KEY HERE",
"internal_ip": "192.168.100.11",
"is_in_cluster" : true,
}
"192.168.100.10": {
"sha": "PLACE KEY HERE",
"internal_ip": "192.168.100.10",
"is_in_cluster": true
},
"192.168.100.11": {
"sha": "PLACE KEY HERE",
"internal_ip": "192.168.100.11",
"is_in_cluster": true
}
}

2 changes: 1 addition & 1 deletion cfe_internal/recommendations.cf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bundle agent MPF_class_recommendations
bundle agent mpf_class_recommendations
{
meta:
(policy_server|am_policy_hub).enterprise_edition::
Expand Down
2 changes: 1 addition & 1 deletion inventory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ R: inventory_lsb: OS = Ubuntu, codename = trusty, release = 14.04, flavor = Ubun

* lives in: `any.cf`
* runs `inventory_control.lldpctl_exec` through a Perl filter
* provides variables: `cfe_autorun_inventory_LLDP.K` for each `K` returned by the LLDB executable
* provides variables: `cfe_autorun_inventory_lldp.K` for each `K` returned by the LLDB executable

## mtab

Expand Down
55 changes: 23 additions & 32 deletions inventory/aix.cf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ bundle agent inventory_aix
# This agent bundle is for AIX inventory work.
{
methods:
"oslevel"
usebundle => inventory_aix_oslevel;
"oslevel" usebundle => inventory_aix_oslevel;
}

bundle agent inventory_aix_oslevel
Expand All @@ -14,65 +13,57 @@ bundle agent inventory_aix_oslevel
# for up to 1 day before re-discovering.
{
vars:

"oslevel"
string => ifelse( isvariable( "paths.oslevel" ), $(paths.oslevel),
"/usr/bin/oslevel" );
string => ifelse(
isvariable("paths.oslevel"), $(paths.oslevel), "/usr/bin/oslevel"
);

commands:

aix::

"$(oslevel)"
handle => "cache_aix_oslevel_s",
args => "-s > $(sys.statedir)/aix-oslevel-s",
if => not( fileexists( "$(sys.statedir)/aix-oslevel-s" ) ),
if => not(fileexists("$(sys.statedir)/aix-oslevel-s")),
contain => in_shell,
comment => "We cache the highest service pack reached to avoid
unnecessary command executions.";

"$(oslevel)"
handle => "cache_aix_oslevel_r",
args => "-r > $(sys.statedir)/aix-oslevel-r",
if => not( fileexists( "$(sys.statedir)/aix-oslevel-r" ) ),
if => not(fileexists("$(sys.statedir)/aix-oslevel-r")),
contain => in_shell,
comment => "We cache the highest technology level reached to avoid
unnecessary command executions.";

files:

aix::

"$(sys.statedir)/aix-oslevel-r"
handle => "cache_expire_aix_oslevel_r",
delete => tidy,
file_select => days_old( 1 ),
file_select => days_old(1),
comment => "We regularly clear the cache to avoid stale data";

"$(sys.statedir)/aix-oslevel-s"
handle => "cache_expire_aix_oslevel_s",
delete => tidy,
file_select => days_old( 1 ),
file_select => days_old(1),
comment => "We regularly clear the cache to avoid stale data";

vars:

vars:
aix::

"oslevel_s"
string => readfile("$(sys.statedir)/aix-oslevel-s", 1K ),
if => fileexists("$(sys.statedir)/aix-oslevel-s"),
meta => { "inventory", "attribute_name=Highest Service Pack" };

"oslevel_r"
string => readfile("$(sys.statedir)/aix-oslevel-r", 1K),
if => fileexists("$(sys.statedir)/aix-oslevel-r"),
meta => { "inventory", "attribute_name=Highest Technology Level" };

reports:

DEBUG::

"Highest Service Pack: $(oslevel_s)";
"Highest Technology Level: $(oslevel_r)";
"oslevel_s"
string => readfile("$(sys.statedir)/aix-oslevel-s", 1K),
if => fileexists("$(sys.statedir)/aix-oslevel-s"),
meta => { "inventory", "attribute_name=Highest Service Pack" };

"oslevel_r"
string => readfile("$(sys.statedir)/aix-oslevel-r", 1K),
if => fileexists("$(sys.statedir)/aix-oslevel-r"),
meta => { "inventory", "attribute_name=Highest Technology Level" };

reports:
DEBUG::
"Highest Service Pack: $(oslevel_s)";
"Highest Technology Level: $(oslevel_r)";
}
4 changes: 2 additions & 2 deletions inventory/any.cf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ bundle agent inventory_autorun
{
methods:
!disable_inventory_LLDP::
"LLDP" usebundle => cfe_autorun_inventory_LLDP(),
"LLDP" usebundle => cfe_autorun_inventory_lldp(),
handle => "cfe_internal_autorun_inventory_LLDP";

!disable_inventory_package_refresh::
Expand Down Expand Up @@ -1066,7 +1066,7 @@ bundle agent cfe_autorun_inventory_dmidecode
"DEBUG $(this.bundle): Obtained Physical memory (MB) = '$(total_physical_memory_MB)'";
}

bundle agent cfe_autorun_inventory_LLDP
bundle agent cfe_autorun_inventory_lldp
# @brief Do LLDP-based inventory
#
# This agent bundle runs lldpctl to discover information. See
Expand Down
Loading
Loading