lib/puppet/provider/sensu_api_config/json.rb
# Internal: Retrieve the current contents of /etc/sensu/config.json.
#
# Returns a Hash representation of the JSON structure in
# /etc/sensu/config.json or an empty Hash if the file can not be read.
Retrieve the current contents of /etc/sensu/config.json.
Returns a Hash representation of the JSON structure in
etc/sensu/config.json or an empty Hash if the file can not be read.
Retrieve the current contents of / etc / sensu / config . json . Returns a Hash representation of the JSON structure in etc / sensu / config . json or an empty Hash if the file can not be read .
def conf
    begin
      @conf ||= JSON.parse(File.read(config_file))
      if @conf['api'].is_a?(Hash)
        exclude_keys = %w(ssl_port ssl_keystore_file ssl_keystore_password)
        @conf['api'].delete_if { |k,_| exclude_keys.include?(k) }
      end
    rescue
      @conf ||= {}
    end
    return @conf
  end
def conf begin @conf ||= JSON . parse ( File . read ( config_file ) ) if @conf [ 'api' ] . is_a? ( Hash ) exclude_keys = %w( ssl_port ssl_keystore_file ssl_keystore_password ) @conf [ 'api' ] . delete_if { | k , _ | exclude_keys . include? ( k ) } end rescue @conf ||= { } end return @conf end
Internal: Retrieve the current contents of /etc/sensu/config.json.
Internal : Retrieve the current contents of / etc / sensu / config . json .
# (#784) Filter out ssl_port, ssl_keystore_file, and ssl_keystore_password