You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The guard allows to set the redis configuration in the first run. Once the breadcrumb is written along with the configuration file, the config is never getting updated anymore. This is the case even while changing the address, the maxclients or any other parameter configurable by this provider.
Solution could be, instead of defining the variables attributes inside the resource, we will fill a variable variables_to_be_set with these information. This variable will be used in the template resource later.
To check, if these variables have changed, we generate a hash and store the value in the breadcrumb file. With these information we are able to guard the template resource by checking if the breadcrumb file contains the fresh calculated hash. If not, we have to execute the template resource, which will write the changed configuration file.
In this case we need to update the breadcrumb file with the new hash, done by the file resource with the modified content and the action changed to create.
This is just a snippets to show the idea and needs to be fleshed out:
variables_to_be_set = variables(
version: version_hash,
piddir: piddir,
...
repldisklesssync: current['repldisklesssync'],
repldisklesssyncdelay: current['repldisklesssyncdelay']
)
config_hash = hash(variables_to_be_set)
# Lay down the configuration files for the current instance
template "#{current['configdir']}/#{server_name}.conf" do
source node['redisio']['redis_config']['template_source']
cookbook node['redisio']['redis_config']['template_cookbook']
owner current['user']
group current['group']
mode current['permissions']
action :create
variables variables_to_be_set
not_if { ::File.foreach("#{current['configdir']}/#{server_name}.conf.breadcrumb").grep(#{config_hash}).any? }}
end
file "#{current['configdir']}/#{server_name}.conf.breadcrumb" do
content 'This file prevents the chef cookbook from overwriting the redis config if config has not changed. \nconfig_hash: #{config_hash}'
action :create
only_if { current['breadcrumb'] == true }
end
Thank you for your excellent code and for maintaining it. :)
The text was updated successfully, but these errors were encountered:
Hi, we solve similar problem using "includes" attribute which is used to include another config file to the initial configuration.
Settings in this included file overrides settings of the initial config file.
The guard allows to set the redis configuration in the first run. Once the breadcrumb is written along with the configuration file, the config is never getting updated anymore. This is the case even while changing the
address
, themaxclients
or any other parameter configurable by this provider.redisio/providers/configure.rb
Line 271 in 80a9edb
Solution could be, instead of defining the variables attributes inside the resource, we will fill a variable
variables_to_be_set
with these information. This variable will be used in the template resource later.To check, if these variables have changed, we generate a hash and store the value in the breadcrumb file. With these information we are able to guard the template resource by checking if the breadcrumb file contains the fresh calculated hash. If not, we have to execute the template resource, which will write the changed configuration file.
In this case we need to update the breadcrumb file with the new hash, done by the file resource with the modified content and the action changed to
create
.This is just a snippets to show the idea and needs to be fleshed out:
Thank you for your excellent code and for maintaining it. :)
The text was updated successfully, but these errors were encountered: