aboutsummaryrefslogtreecommitdiff
path: root/lib/puppet/type/host.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/type/host.rb')
-rw-r--r--lib/puppet/type/host.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/puppet/type/host.rb b/lib/puppet/type/host.rb
index 03059b9..0510180 100644
--- a/lib/puppet/type/host.rb
+++ b/lib/puppet/type/host.rb
@@ -46,8 +46,8 @@ Puppet::Type.newtype(:host) do
validate do |value|
# This regex already includes newline check.
- raise Puppet::Error, _('Host aliases cannot include whitespace') if value =~ %r{\s}
- raise Puppet::Error, _('Host aliases cannot be an empty string. Use an empty array to delete all host_aliases ') if value =~ %r{^\s*$}
+ raise Puppet::Error, _('Host aliases cannot include whitespace') if %r{\s}.match?(value)
+ raise Puppet::Error, _('Host aliases cannot be an empty string. Use an empty array to delete all host_aliases ') if %r{^\s*$}.match?(value)
end
end
@@ -80,7 +80,7 @@ Puppet::Type.newtype(:host) do
validate do |value|
value.split('.').each do |hostpart|
- if hostpart !~ %r{^([\w]+|[\w][\w\-]+[\w])$}
+ unless %r{^([\w]+|[\w][\w\-]+[\w])$}.match?(hostpart)
raise Puppet::Error, _('Invalid host name')
end
end