Skip to content

Commit 37499d9

Browse files
committed
Added recommendation about nfs server and consistent use of root dot
Observed in the wild, sometimes people are inconsistent when specifying nfs server mount points that do or don't include a root dot (trailing dot). Ticket: ENT-13223 Changelog: Title (cherry picked from commit a3e57f8)
1 parent f689f5b commit 37499d9

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

cfe_internal/recommendations.cf

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,46 @@ bundle agent ignore_interfaces_rx_reccomendations
7676
}
7777
@endif
7878

79+
bundle agent nfs_mount_recommendations
80+
# @brief Recommendations about configured NFS servers
81+
{
82+
meta:
83+
84+
"tags" slist => { "cfengine_recommends" };
85+
86+
vars:
87+
"nfs_server_list"
88+
slist => getvalues( "default:inventory_linux.nfs_server"),
89+
depends_on => { "cfe_internal_inventory_mounted_nfs_server" };
90+
91+
classes:
92+
93+
# If we end up emitting the recommendation, then we define a class so that
94+
# instructions about disabling these reports are also emitted.
95+
96+
"cfengine_recommendation_instruct_disablement"
97+
expression => "cfengine_recommendation_emitted_kept",
98+
scope => "namespace";
99+
100+
reports:
101+
102+
"$(with)"
103+
with => concat(
104+
"NOTICE: At least one of your NFS servers is specified",
105+
" in-consistently. Consider aligning your definitions to",
106+
" consistently use or avoid a trailing dot when specifying",
107+
" the NFS server."
108+
),
109+
if => and(
110+
# Check if there exists inventory of mounted nfs servers
111+
isvariable( "nfs_server_list" ),
112+
# Check if any other NFS server looks identical when adding a trailing dot
113+
some( concat( escape("$(nfs_server_list)"), "\.$" ),
114+
"nfs_server_list" )
115+
),
116+
classes => results( "bundle", "cfengine_recommendation_emitted");
117+
}
118+
79119
bundle agent postgresql_conf_recommendations
80120
# @brief Recommendations about the configuration of postgresql.conf for CFEngine Enterprise Hubs
81121
{

inventory/linux.cf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ bundle common inventory_linux
5151

5252
"nfs_server[$(with)]" -> { "CFE-3259", "ENT-13210", "ENT-13223" }
5353
with => regex_replace( "$(nfs_mounts)", ":.*", "", "g" ),
54+
handle => "cfe_internal_inventory_mounted_nfs_server",
5455
string => "$(with)",
5556
meta => { "inventory", "attribute_name=NFS Server" },
5657
if => not( isvariable( "$(this.promiser)" ) );

0 commit comments

Comments
 (0)