Skip to content

Commit

Permalink
Merge pull request #1871 from nickanderson/CFE-3504/master
Browse files Browse the repository at this point in the history
CFE-3504/master: Enabled packages promises using package_module without bundle def
  • Loading branch information
nickanderson authored Nov 30, 2020
2 parents 80588ab + 8877a24 commit e2b3e56
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 29 deletions.
9 changes: 0 additions & 9 deletions controls/def.cf
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,6 @@ bundle common def
int => "200",
if => not( isvariable( "control_server_maxconnections" ) );

# Package inventory refresh
"package_module_query_installed_ifelapsed" -> { "CFE-2771" }
string => "0", # Always refresh local package inventory
if => not( isvariable( $(this.promiser) ));

"package_module_query_updates_ifelapsed" -> { "CFE-2771" }
string => "1440", # 1 day
if => not( isvariable( $(this.promiser) ));

debian::
"environment_vars"
handle => "common_def_vars_environment_vars",
Expand Down
52 changes: 32 additions & 20 deletions lib/packages.cf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ bundle common package_module_knowledge
# platforms.
{
vars:

# Package inventory refresh
"query_installed_ifelapsed" -> { "CFE-2771", "CFE-3504" }
string => ifelse( isvariable( "def.package_module_$(this.promiser)" ),
"$(def.package_module_$(this.promiser))",
"0"); # Always refresh local package inventory

"query_updates_ifelapsed" -> { "CFE-2771", "CFE-3504" }
string => ifelse( isvariable( "def.package_module_$(this.promiser)" ),
"$(def.package_module_$(this.promiser))",
"1440"); # Refresh software updates available once a day

debian::
"platform_default" string => "apt_get";

Expand Down Expand Up @@ -42,14 +54,14 @@ bundle common package_module_knowledge

body package_module apk
{
query_installed_ifelapsed => "$(def.package_module_query_installed_ifelapsed)";
query_updates_ifelapsed => "$(def.package_module_query_updates_ifelapsed)";
query_installed_ifelapsed => "$(package_module_knowledge.query_installed_ifelapsed)";
query_updates_ifelapsed => "$(package_module_knowledge.query_updates_ifelapsed)";
}

body package_module apt_get
{
query_installed_ifelapsed => "$(def.package_module_query_installed_ifelapsed)";
query_updates_ifelapsed => "$(def.package_module_query_updates_ifelapsed)";
query_installed_ifelapsed => "$(package_module_knowledge.query_installed_ifelapsed)";
query_updates_ifelapsed => "$(package_module_knowledge.query_updates_ifelapsed)";
#default_options => {};
@if minimum_version(3.12.2)
termux::
Expand All @@ -59,8 +71,8 @@ body package_module apt_get

body package_module zypper
{
query_installed_ifelapsed => "$(def.package_module_query_installed_ifelapsed)";
query_updates_ifelapsed => "$(def.package_module_query_updates_ifelapsed)";
query_installed_ifelapsed => "$(package_module_knowledge.query_installed_ifelapsed)";
query_updates_ifelapsed => "$(package_module_knowledge.query_updates_ifelapsed)";
#default_options => {};
}

Expand All @@ -81,8 +93,8 @@ body package_module nimclient
# }
# ```
{
query_installed_ifelapsed => "$(def.package_module_query_installed_ifelapsed)";
query_updates_ifelapsed => "$(def.package_module_query_updates_ifelapsed)";
query_installed_ifelapsed => "$(package_module_knowledge.query_installed_ifelapsed)";
query_updates_ifelapsed => "$(package_module_knowledge.query_updates_ifelapsed)";
# This would likey be customized based on your infrastructure specifics
# you may for example want to default the lpp_source based on something
# like `oslevel -s` output.
Expand All @@ -103,39 +115,39 @@ body package_module pkgsrc
# }
# ```
{
query_installed_ifelapsed => "$(def.package_module_query_installed_ifelapsed)";
query_updates_ifelapsed => "$(def.package_module_query_updates_ifelapsed)";
query_installed_ifelapsed => "$(package_module_knowledge.query_installed_ifelapsed)";
query_updates_ifelapsed => "$(package_module_knowledge.query_updates_ifelapsed)";
}

body package_module yum
# @brief Define details used when interfacing with yum
{
query_installed_ifelapsed => "$(def.package_module_query_installed_ifelapsed)";
query_updates_ifelapsed => "$(def.package_module_query_updates_ifelapsed)";
query_installed_ifelapsed => "$(package_module_knowledge.query_installed_ifelapsed)";
query_updates_ifelapsed => "$(package_module_knowledge.query_updates_ifelapsed)";
#default_options => {};
}

body package_module slackpkg
# @brief Define details used when interfacing with slackpkg
{
query_installed_ifelapsed => "$(def.package_module_query_installed_ifelapsed)";
query_updates_ifelapsed => "$(def.package_module_query_updates_ifelapsed)";
query_installed_ifelapsed => "$(package_module_knowledge.query_installed_ifelapsed)";
query_updates_ifelapsed => "$(package_module_knowledge.query_updates_ifelapsed)";
#default_options => {};
}

body package_module pkg
# @brief Define details used when interfacing with pkg
{
query_installed_ifelapsed => "$(def.package_module_query_installed_ifelapsed)";
query_updates_ifelapsed => "$(def.package_module_query_updates_ifelapsed)";
query_installed_ifelapsed => "$(package_module_knowledge.query_installed_ifelapsed)";
query_updates_ifelapsed => "$(package_module_knowledge.query_updates_ifelapsed)";
#default_options => {};
}

body package_module snap
# @brief Define details used when interfacing with snapcraft
{
query_installed_ifelapsed => "$(def.package_module_query_installed_ifelapsed)";
query_updates_ifelapsed => "$(def.package_module_query_updates_ifelapsed)";
query_installed_ifelapsed => "$(package_module_knowledge.query_installed_ifelapsed)";
query_updates_ifelapsed => "$(package_module_knowledge.query_updates_ifelapsed)";
#default_options => {};
}

Expand All @@ -159,8 +171,8 @@ body package_module freebsd_ports
# }
# ```
{
query_installed_ifelapsed => "$(def.package_module_query_installed_ifelapsed)";
query_updates_ifelapsed => "$(def.package_module_query_updates_ifelapsed)";
query_installed_ifelapsed => "$(package_module_knowledge.query_installed_ifelapsed)";
query_updates_ifelapsed => "$(package_module_knowledge.query_updates_ifelapsed)";
}

bundle common packages_common
Expand Down

0 comments on commit e2b3e56

Please sign in to comment.