Skip to content

Commit 843a917

Browse files
authored
Merge pull request #3041 from nickanderson/ENT-13223/master
Inventory Unique NFS Servers and Recommend consistency in definition
2 parents 3380677 + a3e57f8 commit 843a917

2 files changed

Lines changed: 44 additions & 3 deletions

File tree

cfe_internal/recommendations.cf

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,46 @@ bundle agent ignore_interfaces_rx_reccomendations
107107
}
108108
@endif
109109

110+
bundle agent nfs_mount_recommendations
111+
# @brief Recommendations about configured NFS servers
112+
{
113+
meta:
114+
115+
"tags" slist => { "cfengine_recommends" };
116+
117+
vars:
118+
"nfs_server_list"
119+
slist => getvalues( "default:inventory_linux.nfs_server"),
120+
depends_on => { "cfe_internal_inventory_mounted_nfs_server" };
121+
122+
classes:
123+
124+
# If we end up emitting the recommendation, then we define a class so that
125+
# instructions about disabling these reports are also emitted.
126+
127+
"cfengine_recommendation_instruct_disablement"
128+
expression => "cfengine_recommendation_emitted_kept",
129+
scope => "namespace";
130+
131+
reports:
132+
133+
"$(with)"
134+
with => concat(
135+
"NOTICE: At least one of your NFS servers is specified",
136+
" in-consistently. Consider aligning your definitions to",
137+
" consistently use or avoid a trailing dot when specifying",
138+
" the NFS server."
139+
),
140+
if => and(
141+
# Check if there exists inventory of mounted nfs servers
142+
isvariable( "nfs_server_list" ),
143+
# Check if any other NFS server looks identical when adding a trailing dot
144+
some( concat( escape("$(nfs_server_list)"), "\.$" ),
145+
"nfs_server_list" )
146+
),
147+
classes => results( "bundle", "cfengine_recommendation_emitted");
148+
}
149+
110150
bundle agent postgresql_conf_recommendations
111151
# @brief Recommendations about the configuration of postgresql.conf for CFEngine Enterprise Hubs
112152
{

inventory/linux.cf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ bundle common inventory_linux
5050
if => and( not( isvariable( "$(this.promiser)" ) ),
5151
fileexists( "$(mounts)" ) );
5252

53-
"nfs_server[$(nfs_mounts)]" -> { "CFE-3259", "ENT-13210" }
54-
string => regex_replace( "$(nfs_mounts)", ":.*", "", "g" ),
53+
"nfs_server[$(with)]" -> { "CFE-3259", "ENT-13210", "ENT-13223" }
54+
with => regex_replace( "$(nfs_mounts)", ":.*", "", "g" ),
55+
handle => "cfe_internal_inventory_mounted_nfs_server",
56+
string => "$(with)",
5557
meta => { "inventory", "attribute_name=NFS Server" },
5658
if => not( isvariable( "$(this.promiser)" ) );
5759

58-
5960
classes:
6061

6162
any::

0 commit comments

Comments
 (0)