Forum: CFEngine Help Subject: Re: avoiding double-runs to converge when using template operations Author: nicksilkey Link to topic: https://cfengine.com/forum/read.php?3,27428,27429#msg-27429
Here is an example diff which provokes this behavior. In our case, the initial agent run post-changeset would pull down all changes but populate php.ini sourcing the new template ... which expects paramaters to be passed at usebundle() ... which doesnt happen until the second agent run. This renders a busted template on disk until this second agent run. Insight on how to avoid this behavior is appreciated. Index: trunk/dcsunix/php/pub/etc/php.ini.template =================================================================== --- trunk/dcsunix/php/pub/etc/php.ini.template (revision 1185) +++ trunk/dcsunix/php/pub/etc/php.ini.template (working copy) @@ -416,12 +416,14 @@ ; the file operations performed. ; http://www.php.net/manual/en/ini.core.php#ini.realpath-cache-size ;realpath_cache_size = 16k +realpath_cache_size = $(php.realpath_cache_size) ; Duration of time, in seconds for which to cache realpath information for a given ; file or directory. For systems with rarely changing files, consider increasing this ; value. ; http://www.php.net/manual/en/ini.core.php#ini.realpath-cache-ttl ;realpath_cache_ttl = 120 +realpath_cache_ttl = $(php.realpath_cache_ttl) ;;;;;;;;;;;;;;;;; ; Miscellaneous ; @@ -432,7 +434,8 @@ ; threat in any way, but it makes it possible to determine whether you use PHP ; on your server or not. ; http://www.php.net/manual/en/ini.core.php#ini.expose-php -expose_php = On +;expose_php = On +expose_php = $(php.expose_php) ;;;;;;;;;;;;;;;;;;; ; Resource Limits ; @@ -440,7 +443,8 @@ ; Maximum execution time of each script, in seconds ; http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time -max_execution_time = 30 +;max_execution_time = 30 +max_execution_time = $(php.max_execution_time) ; Maximum amount of time each script may spend parsing request data. It's a good ; idea to limit this time on productions servers in order to eliminate unexpectedly @@ -449,7 +453,8 @@ ; Development Value: 60 (60 seconds) ; Production Value: 60 (60 seconds) ; http://www.php.net/manual/en/info.configuration.php#ini.max-input-time -max_input_time = 60 +;max_input_time = 60 +max_input_time = $(php.max_input_time) ; Maximum input variable nesting level ; http://www.php.net/manual/en/info.configuration.php#ini.max-input-nesting-level @@ -457,7 +462,8 @@ ; Maximum amount of memory a script may consume (128MB) ; http://www.php.net/manual/en/ini.core.php#ini.memory-limit -memory_limit = 128M +;memory_limit = 128M +memory_limit = $(php.memory_limit) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Error handling and logging ; @@ -513,7 +519,8 @@ ; Development Value: E_ALL | E_STRICT ; Production Value: E_ALL & ~E_DEPRECATED ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting -error_reporting = E_ALL & ~E_DEPRECATED +;error_reporting = E_ALL & ~E_DEPRECATED +error_reporting = $(php.error_reporting) ; This directive controls whether or not and where PHP will output errors, ; notices and warnings too. Error output is very useful during development, but @@ -729,7 +736,8 @@ ; Maximum size of POST data that PHP will accept. ; http://www.php.net/manual/en/ini.core.php#ini.post-max-size -post_max_size = 8M +;post_max_size = 8M +post_max_size = $(php.post_max_size) ; Magic quotes are a preprocessing feature of PHP where PHP will attempt to ; escape any character sequences in GET, POST, COOKIE and ENV data which might @@ -878,7 +886,8 @@ ; Maximum allowed size for uploaded files. ; http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize -upload_max_filesize = 2M +;upload_max_filesize = 2M +upload_max_filesize = $(php.upload_max_filesize) ;;;;;;;;;;;;;;;;;; ; Fopen wrappers ; @@ -947,6 +956,7 @@ ; Defines the default timezone used by the date functions ; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone ;date.timezone = +date.timezone = $(php.date_timezone) ; http://www.php.net/manual/en/datetime.configuration.php#ini.date.default-latitude ;date.default_latitude = 31.7667 @@ -1036,7 +1046,8 @@ ;mail.force_extra_parameters = ; Add X-PHP-Originaiting-Script: that will include uid of the script followed by the filename -mail.add_x_header = On +;mail.add_x_header = On +mail.add_x_header = $(php.mail_add_x_header) ; Log all mail() calls including the full path of the script, line #, to address and headers ;mail.log = Index: trunk/inputs/dcsunix/main.cf =================================================================== --- trunk/inputs/dcsunix/main.cf (revision 1185) +++ trunk/inputs/dcsunix/main.cf (working copy) @@ -391,7 +391,18 @@ ); "php" - usebundle => php; + usebundle => php( "800k", # realpath_cache_size + "300", # realpath_cache_ttl + "Off", # expose_php + "128M", # memory_limit + "60", # max_execution_time + "60", # max_input_time + "E_ALL & ~E_NOTICE", # error_reporting + "85M", # post_max_size + "75M", # upload_max_filesize + "America/New_York", # date.timezone + "On" # mail.add_x_header + ); "drush" usebundle => drush( "5.7" # version ); @@ -435,7 +446,18 @@ "$(drupal7.appGroup)" # Group ); "php" - usebundle => php; + usebundle => php( "800k", # realpath_cache_size + "300", # realpath_cache_ttl + "Off", # expose_php + "128M", # memory_limit + "60", # max_execution_time + "60", # max_input_time + "E_ALL & ~E_DEPRECATED", # error_reporting + "85M", # post_max_size + "75M", # upload_max_filesize + "America/New_York", # date.timezone + "On" # mail.add_x_header + ); "drush" usebundle => drush( "5.4" # version ); Index: trunk/inputs/dcsunix/php.cf =================================================================== --- trunk/inputs/dcsunix/php.cf (revision 1185) +++ trunk/inputs/dcsunix/php.cf (working copy) @@ -4,7 +4,19 @@ # ############################################################################ -bundle agent php { +bundle agent php ( + realpath_cache_size, # realpath_cache_size + realpath_cache_ttl, # realpath_cache_ttl + expose_php, # expose_php + memory_limit, # memory_limit + max_execution_time, # max_execution_time + max_input_time, # max_input_time + error_reporting, # error_reporting + post_max_size, # post_max_size + upload_max_filesize, # upload_max_filesize + date_timezone, # date.timezone + mail_add_x_header # mail.add_x_header +) { vars: And it takes two runs to get the endstate as expected: # cf-agent -K -> Updated /etc/php.ini.template from source /var/cfengine/masterfiles/dcsunix/php/pub/etc/php.ini.template on vm-cfgprdapp-01.its.yale.edu -> Object /etc/php.ini.template had permission 600, changed it to 644 -> Edited file /etc/php.ini cf3 -> Finished script - succeeded /etc/init.d/httpd restart # cf-agent -K -> Edited file /etc/php.ini cf3 -> Finished script - succeeded /etc/init.d/httpd restart # cf-agent -K # _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine