Skip to content
Open
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
63 changes: 0 additions & 63 deletions inventory/any.cf
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ bundle agent inventory_autorun
"LLDP" usebundle => cfe_autorun_inventory_LLDP(),
handle => "cfe_internal_autorun_inventory_LLDP";

!disable_inventory_package_refresh::
"packages_refresh" usebundle => cfe_autorun_inventory_packages(),
handle => "cfe_internal_autorun_inventory_packages";

!disable_inventory_policy_servers::
"Inventory Policy Servers"
handle => "cfe_internal_autorun_inventory_policy_servers",
Expand Down Expand Up @@ -1093,65 +1089,6 @@ bundle agent cfe_autorun_inventory_LLDP
lldpctl is customized via augments";
}

bundle agent cfe_autorun_inventory_packages
# @brief Package inventory auto-refresh
#
# This bundle is for refreshing the package inventory. It runs on
# startup, unless disabled. Other package methods can be added below.
{
classes:
"have_patches" or => { "community_edition", # not in Community
fileexists("$(sys.workdir)/state/software_patches_avail.csv") };

"have_inventory" and => { "have_patches",
fileexists("$(sys.workdir)/state/software_packages.csv"),
};

"use_package_module_for_inventory" or => { "redhat", "debian", "suse", "sles", "alpinelinux", "windows" };
"use_package_method_for_inventory" or => { "gentoo", "aix" };
"use_package_method_generic_for_inventory"
not => "use_package_module_for_inventory|use_package_method_for_inventory";

vars:
# if we have the patches, 7 days; otherwise keep trying
"refresh" string => ifelse("have_inventory", "10080",
"0");

packages:

# The legacy implementation (package_method) of the packages type promise
# requires a packages promise to be triggered in order to generate package
# inventory. The following promises ensure that package inventory data
# exists. As package modules become available the package_methods should be
# removed.

aix::
"cfe_internal_non_existing_package"
package_policy => "add",
package_method => inventory_lslpp($(refresh)),
action => if_elapsed_day;

gentoo::
"cfe_internal_non_existing_package"
package_policy => "add",
package_method => emerge,
action => if_elapsed_day;

use_package_method_generic_for_inventory::
"cfe_internal_non_existing_package"
package_policy => "add",
package_method => generic,
action => if_elapsed_day;

reports:
DEBUG|DEBUG_cfe_autorun_inventory_packages::
"DEBUG $(this.bundle): refresh interval is $(refresh)";
"DEBUG $(this.bundle): we have the inventory files."
if => "have_inventory";
"DEBUG $(this.bundle): we don't have the inventory files."
if => "!have_inventory";
}

bundle agent cfe_autorun_inventory_policy_servers
# @brief Inventory policy servers
{
Expand Down
17 changes: 15 additions & 2 deletions tests/acceptance/17_packages/11_old/unsafe/12_packagesmatching.cf
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,31 @@ body common control

bundle agent init
{
vars:

# if we have the patches, 7 days; otherwise keep trying
"refresh" string => ifelse("have_inventory", "10080",
"0");
classes:
"have_patches" or => { "community_edition", # not in Community
fileexists("$(sys.workdir)/state/software_patches_avail.csv") };

"have_inventory" and => { "have_patches",
fileexists("$(sys.workdir)/state/software_packages.csv"),
};

packages:
# Old way of forcing package updates, for the legacy packages promise.
debian::
"cfe_internal_non_existing_package"
package_policy => "add",
package_method => inventory_apt_get($(cfe_autorun_inventory_packages.refresh)),
package_method => inventory_apt_get($(refresh)),
action => if_elapsed_day;

redhat::
"cfe_internal_non_existing_package"
package_policy => "add",
package_method => inventory_yum_rpm($(cfe_autorun_inventory_packages.refresh)),
package_method => inventory_yum_rpm($(refresh)),
action => if_elapsed_day;

vars:
Expand Down
17 changes: 15 additions & 2 deletions tests/acceptance/17_packages/11_old/unsafe/package-inventory.cf
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,31 @@ bundle agent init

bundle agent test
{
vars:

# if we have the patches, 7 days; otherwise keep trying
"refresh" string => ifelse("have_inventory", "10080",
"0");
classes:
"have_patches" or => { "community_edition", # not in Community
fileexists("$(sys.workdir)/state/software_patches_avail.csv") };

"have_inventory" and => { "have_patches",
fileexists("$(sys.workdir)/state/software_packages.csv"),
};

packages:
# Old way of forcing package updates, for the legacy packages promise.
debian::
"cfe_internal_non_existing_package"
package_policy => "add",
package_method => inventory_apt_get($(cfe_autorun_inventory_packages.refresh)),
package_method => inventory_apt_get($(refresh)),
action => if_elapsed_day;

redhat::
"cfe_internal_non_existing_package"
package_policy => "add",
package_method => inventory_yum_rpm($(cfe_autorun_inventory_packages.refresh)),
package_method => inventory_yum_rpm($(refresh)),
action => if_elapsed_day;

methods:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,31 @@ body common control

bundle agent init
{
vars:

# if we have the patches, 7 days; otherwise keep trying
"refresh" string => ifelse("have_inventory", "10080",
"0");
classes:
"have_patches" or => { "community_edition", # not in Community
fileexists("$(sys.workdir)/state/software_patches_avail.csv") };

"have_inventory" and => { "have_patches",
fileexists("$(sys.workdir)/state/software_packages.csv"),
};

packages:
# Old way of forcing package updates, for the legacy packages promise.
debian::
"cfe_internal_non_existing_package"
package_policy => "add",
package_method => inventory_apt_get($(cfe_autorun_inventory_packages.refresh)),
package_method => inventory_apt_get($(refresh)),
action => if_elapsed_day;

redhat::
"cfe_internal_non_existing_package"
package_policy => "add",
package_method => inventory_yum_rpm($(cfe_autorun_inventory_packages.refresh)),
package_method => inventory_yum_rpm($(refresh)),
action => if_elapsed_day;
}

Expand Down