eucalyptus / calyptos

Tool for Managing Eucalyptus
BSD 2-Clause "Simplified" License
5 stars 14 forks source link

Validate params related to bind interface #86

Open nephomaniac opened 8 years ago

nephomaniac commented 8 years ago

Currently the cookbooks are referencing attributes related to the bind interface but do not have sane defaults and nil/null checks in place. The usage and presence of these attributes needs to be covered by Calyptos validations, as well as handled better in the Cookbooks themselves.

nephomaniac commented 8 years ago

Examples:

^[[0mNoMethodError^[[0m -------------^[[0m undefined method `first' for nil:NilClass^[[0m

^[[0mCookbook Trace:^[[0m ---------------^[[0m /root/.chef/local-mode-cache/cache/cookbooks/eucalyptus/libraries/bind-addr.rb:27:in get_bind_interface_ip' ^[[0m /root/.chef/local-mode-cache/cache/cookbooks/eucalyptus/recipes/cloud-service.rb:43:infrom_file' ^[[0m /root/.chef/local-mode-cache/cache/cookbooks/eucalyptus/recipes/user-facing.rb:22:in `from_file'^[[0m

^[[0mRelevant File Content:^[[0m ----------------------^[[0m /root/.chef/local-mode-cache/cache/cookbooks/eucalyptus/libraries/bind-addr.rb: ^[[0m ^[[0m 20: ^[[0m 21: module Eucalyptus ^[[0m 22: module BindAddr ^[[0m 23: def self.get_bind_interface_ip(node) ^[[0m 24: bind_interface = node["eucalyptus"]["bind-interface"] ^[[0m 25: raise "Setting the bind interface was requested but not bind-interface parameter was set" if bind_interface.nil? ^[[0m 26: if node["network"]["interfaces"].has_key? bind_interface ^[[0m 27>> bind_addr = node[:network][:interfaces][bind_interface][:addresses].find {|addr, addr_info| addr_info[:family] == "inet"}.first ^[[0m 28: bind_addr ^[[0m 29: else ^[[0m 30: raise "Unable to find requested bind interface #{bind_interface} on #{node["ipaddress"]}" ^[[0m 31: end ^[[0m 32: end ^[[0m 33: end ^[[0m 34: end ^[[0m 35: ^[[0m

^[[0m^[[0m