<commit_before>Puppet::Type.newtype(:netapp_export) do 
  @doc = "Manage Netapp NFS Export creation, modification and deletion."
  
  apply_to_device
  
  ensurable do
    desc "Netapp NFS Export resource state. Valid values are: present, absent."
    
    defaultto(:present)
    
    newvalue(:present) do 
      provider.create
    end
    
    newvalue(:absent) do 
      provider.destroy
    end
  end
  
  newparam(:name) do
    desc "The export name."
    isnamevar
  end

  newparam(:persistent) do
    desc "Persistent export?"
    newvalues(:true, :false)
    defaultto(:true)
  end
  
  newparam(:path) do
    desc "The filer path to export."
    defaultto { @resource[:name] }
  end
  
end<commit_msg>(#5) Updated netapp_export type to support input validation.<commit_after>Puppet::Type.newtype(:netapp_export) do 
  @doc = "Manage Netapp NFS Export creation, modification and deletion."
  
  apply_to_device
  
  ensurable do
    desc "Netapp NFS Export resource state. Valid values are: present, absent."
    
    defaultto(:present)
    
    newvalue(:present) do 
      provider.create
    end
    
    newvalue(:absent) do 
      provider.destroy
    end
  end
  
  newparam(:name) do
    desc "The export name. Valid format is /vol/[volume_name](/[qtree_name])."
    isnamevar
    validate do |value|
    	unless value =~ /^(\/[\w]+){2,3}$/
        	raise ArgumentError, "%s is not a valid export name." % value
        end
    end
  end

  newparam(:persistent) do
    desc "Should this be a persistent export? Defaults to true."
    newvalues(:true, :false)
    defaultto(:true)
  end
  
  newparam(:path) do
    desc "The filer path to export. If not specified, uses :name value"
    defaultto { @resource[:name] }
    validate do |value|
    	unless value =~ /^(\/[\w]+){2,3}$/
        	raise ArgumentError, "%s is not a valid export filer path." % value
        end
    end
  end
  
end
{'fraction_non_alphanumeric': 0.10209424083769633, 'fraction_numerical': 0.002617801047120419, 'mean_word_length': 2.6193181818181817, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7198959', 'n_tokens_mistral': 627, 'n_tokens_neox': 608, 'n_words': 188}