diff options
author | Bobosila Victor <vbobosila1@gmail.com> | 2021-09-25 13:15:58 +0300 |
---|---|---|
committer | Bobosila Victor <vbobosila1@gmail.com> | 2021-10-01 14:04:22 +0300 |
commit | 36a46c84de29e127dee95ebd5caa992ac39046b6 (patch) | |
tree | 34b66f1fdfd8205489cfa2b1c3d7a24b0a7f7a50 /lib | |
parent | e78ecf8948988656bcb83aff2587f1641099416d (diff) | |
download | puppet-hosts_core-36a46c84de29e127dee95ebd5caa992ac39046b6.tar.gz puppet-hosts_core-36a46c84de29e127dee95ebd5caa992ac39046b6.tar.bz2 |
(MODULES-11197) Rubocop fixes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/type/host.rb | 6 |
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 |