summaryrefslogtreecommitdiff
path: root/lib/chef/resource
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-10-16 10:35:35 -0700
committerTim Smith <tsmith84@gmail.com>2020-10-16 10:35:35 -0700
commit04a23bb2d1b3243f09e7c63f2c755fbaefcd5d87 (patch)
treef3edd4a0f410d589ee10f30d4e4c873cd9a8a7ad /lib/chef/resource
parentb4e7913972e70b42e632a33930417fb37d2bddd1 (diff)
downloadchef-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.rb2
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)