From 36a46c84de29e127dee95ebd5caa992ac39046b6 Mon Sep 17 00:00:00 2001 From: Bobosila Victor Date: Sat, 25 Sep 2021 13:15:58 +0300 Subject: (MODULES-11197) Rubocop fixes --- lib/puppet/type/host.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/puppet') 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 -- cgit v1.2.3