Advertisement
fatmcgav

Custom_function nilClass

Mar 21st, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.59 KB | None | 0 0
  1. #Parse_databases.rb snip
  2. module Puppet::Parser::Functions
  3.   newfunction(:parse_databases, :type => :rvalue, :doc =>
  4.     "This function accepts an input hash, a filter and a matcher value.
  5.    It then parses the hash based on the filter, and any matches are returned in a hash.
  6.    If no results are found, then nil is returned.
  7.  
  8.    Valid filters are:
  9.     * 'database',
  10.     * 'netapp_primary_controller',
  11.     * 'netapp_snapmirror_controller',
  12.     * 'database_primary_server',
  13.     * 'database_replication_server'"
  14.   ) do |arguments|
  15.  
  16. Puppet::Parser::Functions.autoloader.loadall
  17. ...
  18.           db_servers = function_foreman(['fact_values', "fact = ipaddress and (host = #{value['database_primary_server']} or host = #{value['database_replication_server']})"])
  19.           raise Puppet::ParseError, "Foreman function returned no details." if db_servers.nil?
  20.           function_notice(["DB_servers looks like: #{db_servers}. Nil = #{db_servers.nil?}. Class = #{db_servers.class}."])
  21.           db_servers.each do |name, details|
  22.             # Add ipaddress value to allowed_hosts array
  23.             debug "Name = #{name}"
  24.             debug "IPAddress = #{details['ipaddress']}"
  25.             allowed_hosts << details['ipaddress'] unless details['ipaddress'].nil?
  26.           end
  27.  
  28. # Puppet error
  29. Error: Could not retrieve catalog from remote server: Error 400 on SERVER: undefined method `each' for nil:NilClass at /etc/puppet/modules/common/act/manifests/server/linux/db/oracle.pp:175 on node act-star-db05.card.co.uk
  30. Warning: Not using cache on failed catalog
  31. Error: Could not retrieve catalog; skipping run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement