sap-oc / crowbar-openstack

Openstack deployment for Crowbar
3 stars 1 forks source link

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

Open vuntz opened 7 years ago

vuntz commented 7 years ago

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 commented 7 years ago

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