Skip to content

Commit ca39f9b

Browse files
tzznickanderson
authored andcommitted
Fixed converge edit_line bundle not deleting lines containing marker
In my testing with 3.16, the deletion doesn't work today, so `converge` is not functioning properly. (cherry picked from commit fae4505) Ticket: CFE-3482 Changelog: Title
1 parent c4159eb commit ca39f9b

1 file changed

Lines changed: 21 additions & 17 deletions

File tree

lib/files.cf

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,37 +1066,41 @@ bundle edit_line converge(marker, lines)
10661066
#
10671067
# @param marker The marker (not a regular expression; will be escaped)
10681068
# @param lines The lines to insert; all must contain `marker`
1069+
#
1070+
# **Example:**
1071+
#
1072+
# ```cf3
1073+
# bundle agent pam_d_su_include
1074+
# #@brief Ensure /etc/pam.d/su has includes configured properly
1075+
# {
1076+
# files:
1077+
# ubuntu::
1078+
# "/etc/pam.d/su"
1079+
# edit_line => converge( "@include", "@include common-auth
1080+
# @include common-account
1081+
# @include common-session");
1082+
# }
1083+
# ```
1084+
#
1085+
# **History:**
1086+
#
1087+
# * Introduced in 3.6.0
10691088
{
10701089
vars:
10711090
"regex" string => escape($(marker));
10721091

10731092
delete_lines:
1074-
"$(regex)" comment => "Delete lines matching the marker";
1093+
".*$(regex).*" comment => "Delete lines matching the marker";
10751094
insert_lines:
10761095
"$(lines)" comment => "Insert the given lines";
10771096
}
10781097

10791098
bundle edit_line converge_prepend(marker, lines)
1080-
# @brief Converge `lines` marked with `marker` to start of content.
1099+
# @brief Converge `lines` marked with `marker` to start of content
10811100
#
10821101
# Any content marked with `marker` is removed, then `lines` are
10831102
# inserted at *start* of content. Every `line` should contain `marker`.
10841103
#
1085-
# This is helpful for files where order matters, like `pam.d/common-auth`,
1086-
# and you want the content at the top. If you want to maintain the order
1087-
# of multiple lines, pass one item with a newline in it like this:
1088-
#
1089-
# **Example:**
1090-
#
1091-
# ```cf3
1092-
# files:
1093-
# "/etc/pam.conf"
1094-
# edit_line => converge_prepend("session", "session required pam_loginuid.so
1095-
#session required pam_env.so
1096-
#session required pam_env.so envfile=/etc/default/locale
1097-
#session required pam_limits.so");
1098-
# ```
1099-
#
11001104
# @param marker The marker (not a regular expression; will be escaped)
11011105
# @param lines The lines to insert; all must contain `marker`
11021106
#

0 commit comments

Comments
 (0)