diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-10-16 10:35:35 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-10-16 10:35:35 -0700 |
commit | 04a23bb2d1b3243f09e7c63f2c755fbaefcd5d87 (patch) | |
tree | f3edd4a0f410d589ee10f30d4e4c873cd9a8a7ad /lib/chef/resource | |
parent | b4e7913972e70b42e632a33930417fb37d2bddd1 (diff) | |
download | chef-04a23bb2d1b3243f09e7c63f2c755fbaefcd5d87.tar.gz |
Avoid using complex regexes when we can use include?
The ifconfig part needs a complete rewrite, but this is better. At least it's not doing a regex twice for each thing it wants to match per line. It still does 5 regexes even if it matches on the first.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource')
-rw-r--r-- | lib/chef/resource/hostname.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/resource/hostname.rb b/lib/chef/resource/hostname.rb index e959084fa5..07a71864c2 100644 --- a/lib/chef/resource/hostname.rb +++ b/lib/chef/resource/hostname.rb @@ -224,7 +224,7 @@ class Chef else # windows WINDOWS_EC2_CONFIG = 'C:\Program Files\Amazon\Ec2ConfigService\Settings\config.xml'.freeze - raise "Windows hostnames cannot contain a period." if new_resource.hostname.match?(/\./) + raise "Windows hostnames cannot contain a period." if new_resource.hostname.include?(".") # suppress EC2 config service from setting our hostname if ::File.exist?(WINDOWS_EC2_CONFIG) |