What's the paragaraph equivalent to select_line_matching() ?
Situation: I've written a promise to insert "extension=http.so" into
/etc/php.ini
in the Dynamic Extensions section so that Apache httpd's mod_php dynamically
loads the "pecl_http" module which is needed by our Web app, however
I've anchored the edit on the "Dynamic Extensions" LINE since I could not
or did not know how to anchor it on the "Dynamic Extensions" PARAGRAPH.
So the output looks ugly. How to insert after a paragraph, please?
Here is what I get:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
extension=http.so ; Our module XYZ requires HttpRequest which is
provided by pecl_http
;;;;;;;;;;;;;;;;;;;;;;
;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
; extension=modulename.extension
;
; For example:
;
; extension=msql.so
;
; Note that it should be the name of the module only; no directory information
; needs to go here. Specify the location of the extension with the
; extension_dir directive above.
Here is what I want:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
; extension=modulename.extension
;
; For example:
;
; extension=msql.so
;
; Note that it should be the name of the module only; no directory information
; needs to go here. Specify the location of the extension with the
; extension_dir directive above.
extension=http.so ; Our module XYZ requires HttpRequest which is
provided by pecl_http
I know I could anchor on the bottom line, I am just asking if there is
(or could be)
a select_paragraph_matching? Seems to me like that could be very useful.
-------- start of bundle -------
bundle agent php_pecl_http_extension_is_installed_and_configured {
files:
app::
"/etc/php.ini"
edit_line => tell_php_to_load_http_extension;
}
bundle edit_line tell_php_to_load_http_extension {
vars:
"dynamically_load_http_module" string => "extension=http.so
; Our module XYZ requires HttpRequest which is provided by pecl_http";
# this is the text we want in /etc/php.ini
insert_lines:
"$(dynamically_load_http_module)"
insert_type => "preserve_block",
location => in_Dynamic_Extensions_section;
}
body location in_Dynamic_Extensions_section
{
before_after => "after";
first_last => "first";
select_line_matching => "; Dynamic Extensions ;";
}
-------- end of bundle -------
Best,
-at
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine