<commit_before>module Infoblox
  module Api

    def connection
      creds = data_bag_item('infoblox', 'credentials')
      @connection ||= Infoblox::Connection.new( username: creds['username'],
                                                password: creds['password'],
                                                host: creds['hostname'] )
    end

    def create_host_record(params)
      record = Infoblox::Host.new(connection: connection, ipv4addrs: params[:ipv4addrs], name: params[:name])
      record.aliases = params[:aliases] if params[:aliases]
      record.view = params[:view] if params[:view]
      record.extattrs = params[:extattrs] if params[:extattrs]
      begin
        resp = record.post
        Chef::Log.info 'Host record successfully created.'<commit_msg>Add NIOS node attributes value<commit_after>module Infoblox
  module Api

    def connection
      creds = data_bag_item('infoblox', 'credentials')
      @connection ||= Infoblox::Connection.new( username: creds['username'] || node['infoblox']['username'],
                                                password: creds['password'] || node['infoblox']['password'],
                                                host: creds['hostname'] || node['infoblox']['nios_appliance'] )
    end

    def create_host_record(params)
      record = Infoblox::Host.new(connection: connection, ipv4addrs: params[:ipv4addrs], name: params[:name])
      record.aliases = params[:aliases] if params[:aliases]
      record.view = params[:view] if params[:view]
      record.extattrs = params[:extattrs] if params[:extattrs]
      begin
        resp = record.post
        Chef::Log.info 'Host record successfully created.'
{'fraction_non_alphanumeric': 0.12211025489033787, 'fraction_numerical': 0.0023710729104919974, 'mean_word_length': 2.553684210526316, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6782716', 'n_tokens_mistral': 456, 'n_tokens_neox': 444, 'n_words': 100}