On Jun 3, 11:58 am, treydock <
treyd...@gmail.com> wrote:
> I am getting the following error on about every other manual run of
> puppet... (hostnames removed)
>
> err: Could not retrieve catalog from remote server: Error 400 on
> SERVER: Failed to parse template zabbix/userparameter_mysql_conf.erb:
> Could not find value for 'zabbix_mysql_user_parameters' at /etc/puppet/
> modules/zabbix/manifests/classes/mysql.pp:7 on node
> puppetclient.domain
If runs sometimes succeed and sometimes fail for the same node then
you probably have a missing dependency somewhere. If there were
exactly one missing dependency involved then the first-order estimate
would be that half your runs would fail.
The variable definition is at top level in the class's file? And
you're relying on that to provide a default definition of the
variable? Ew. Now you have dynamic scoping thrown in. But that
ought to be parse-order dependent, so although it could explain some
nodes succeeding but others failing, I don't think it explains
individual nodes flopping back and forth between success and failure.
> Here's the variables usage in the template...
> <% zabbix_mysql_user_parameters.each do |key, value_hash| -%>
> UserParameter=<%= value_hash['name'] %>,HOME=<%= zabbix_user_home_dir
> %> <%= value_hash['command'] %>
> <% end -%>
>
> Would the solution be to make the template call use this instead??
>
> <% if has_variable?("zabbix_mysql_user_parameters") -%>
> <% zabbix_mysql_user_parameters.each do |key, value_hash| -%>
> UserParameter=<%= value_hash['name'] %>,HOME=<%= zabbix_user_home_dir
> %> <%= value_hash['command'] %>
> <% end -%>
> <% end -%>
Maybe. Does the node that has a customized value for the variable
ever fail? Does it always get the userparameter_mysql.conf template
filled correctly? If so then yes, your template change should do the
trick, and you could then also remove the default variable definition
(which isn't reliably working anyway).
Otherwise, probably not. That solution would likely make the errors
disappear, but it wouldn't fix the actual problem. Chances are that
nodes with customized $zabbix_mysql_user_parameters would flip flop.
In that case, the solution would probably require figuring out what
dependency is needed and putting it in.
John