Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case of HA proposal matters (and can break things) when applying database (and probably others) #32

Open
vuntz opened this issue Mar 28, 2017 · 1 comment

Comments

@vuntz
Copy link

vuntz commented Mar 28, 2017

This issue was hit:

================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/database/recipes/server.rb
================================================================================

NoMethodError
-------------
undefined method `[]' for nil:NilClass

Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/database/libraries/crowbar.rb:16:in `get_listen_address'
  /var/chef/cache/cookbooks/postgresql/recipes/server.rb:29:in `from_file'
  /var/chef/cache/cookbooks/database/recipes/server.rb:24:in `from_file'

Relevant File Content:
----------------------
/var/chef/cache/cookbooks/database/libraries/crowbar.rb:

  9:      end
 10:    end
 11:  
 12:    def self.get_listen_address(node)
 13:      if node[:database][:ha][:enabled]
 14:        vhostname = get_ha_vhostname(node)
 15:        net_db = Chef::DataBagItem.load("crowbar", "admin_network").raw_data
 16>>       net_db["allocated_by_name"]["#{vhostname}.#{node[:domain]}"]["address"]
 17:      else
 18:        Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address
 19:      end
 20:    end
 21:  end
 22:  

After some debugging, everything looked fine (cluster was used, data bag for admin network had the entry, etc.). But it turns out that we have:

pacemaker.config.environment:  pacemaker-config-Control

And when we build the HA vhostname, we don't move to lowercase. So it's very likely that it was caused by the fact that the data bag had the hostname all lowercase, but the query we were doing was not all lowercase.

@mkoderer
Copy link

mkoderer commented Jun 8, 2017

@vuntz can you give more detail - is this a issue in our prod? What priority has it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants