<commit_before>require 'json'

class Puppet::Provider::Sensuctl < Puppet::Provider
  initvars

  commands :sensuctl => 'sensuctl'

  def self.type_properties
    resource_type.validproperties.reject { |p| p.to_sym == :ensure }
  end
  def type_properties
    self.class.type_properties
  end

  def convert_boolean_property_value(value)
    case value
    when :true
      true
    when :false
      false
    else
      value
    end
  end

  def self.sensuctl(args)
    execute(['sensuctl'] + args, combine: false, failonfail: true)
  end

  def self.sensuctl_list(command)
    args = [command]
    args << 'list'
    args << '--all-organizations'
    args << '--format'
    args << 'json'
    sensuctl(args)
  end

  def self.sensuctl_create(command, name, flags)
    args = [command]
    args << 'create'
    args << name<commit_msg>Remove unnecessary sensuctl method<commit_after>require 'json'

class Puppet::Provider::Sensuctl < Puppet::Provider
  initvars

  commands :sensuctl => 'sensuctl'

  def self.type_properties
    resource_type.validproperties.reject { |p| p.to_sym == :ensure }
  end
  def type_properties
    self.class.type_properties
  end

  def convert_boolean_property_value(value)
    case value
    when :true
      true
    when :false
      false
    else
      value
    end
  end

  #def self.sensuctl(args)
  #  execute(['sensuctl'] + args, combine: false, failonfail: true)
  #end

  def self.sensuctl_list(command)
    args = [command]
    args << 'list'
    args << '--all-organizations'
    args << '--format'
    args << 'json'
    sensuctl(args)
  end

  def self.sensuctl_create(command, name, flags)
    args = [command]
    args << 'create'
    args << name
{'fraction_non_alphanumeric': 0.10895170789163722, 'fraction_numerical': 0.0, 'mean_word_length': 2.9511627906976745, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2739450', 'n_tokens_mistral': 594, 'n_tokens_neox': 569, 'n_words': 136}