summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-05-16 09:29:10 -0700
committerGitHub <noreply@github.com>2018-05-16 09:29:10 -0700
commit7c2950ef5fcafc127b700cba123d57b5e6273c21 (patch)
tree96e6257b990be5453ce491f72ee42bbcc8678c9f
parentd9346c56d0ca8f18cef61cb9d2581886b300d26f (diff)
parentab3a6d2af400fa09e4111e7ed3eb4dcc85a91acd (diff)
downloadchef-7c2950ef5fcafc127b700cba123d57b5e6273c21.tar.gz
Merge pull request #7262 from bottkv488/fix_resource_hostname
improved regex accuracy lib/chef/resource/hostname.rb
-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 243c86287b..878f502dae 100644
--- a/lib/chef/resource/hostname.rb
+++ b/lib/chef/resource/hostname.rb
@@ -116,7 +116,7 @@ class Chef
# this must come before other methods like /etc/hostname and /etc/sysconfig/network
declare_resource(:execute, "hostnamectl set-hostname #{new_resource.hostname}") do
notifies :reload, "ohai[reload hostname]"
- not_if { shell_out!("hostnamectl status", { :returns => [0, 1] }).stdout =~ /Static hostname:\s+#{new_resource.hostname}/ }
+ not_if { shell_out!("hostnamectl status", { :returns => [0, 1] }).stdout =~ /Static hostname:\s*#{new_resource.hostname}\s*$/ }
end
when ::File.exist?("/etc/hostname")
# debian family uses /etc/hostname