Module: EasyType::Validators::IPFQDN

Defined in:
lib/easy_type/validators.rb

Overview

This validator validates if it is valid FQDN with at least a domain name or an IP address

Examples:


newparam(:name) do
  include ::EasyType::Validators::IPFQDN

Raises:

  • (Puppet::Error)

    when the name is invalid

Class Method Summary collapse

Class Method Details

.unsafe_validate(value) ⇒ Object



180
181
182
183
# File 'lib/easy_type/validators.rb', line 180

def unsafe_validate(value)
  return if value == 'absent'
  fail Puppet::Error, "#{value} is not valid as a FQDN or IP address" unless value =~ Regexp.union(EasyType::FQDN, Resolv::AddressRegex)
end