summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Ott <bernhard.ott@westernacher.com>2018-05-15 16:45:46 +0200
committerBernhard Ott <bernhard.ott@westernacher.com>2018-05-15 20:17:49 +0200
commitab3a6d2af400fa09e4111e7ed3eb4dcc85a91acd (patch)
tree39540dff116f4f229307f7a3a790889882a44840
parentc0609e449135fae43d436136a4f0fd3889a9b8f1 (diff)
downloadchef-ab3a6d2af400fa09e4111e7ed3eb4dcc85a91acd.tar.gz
improved regex accuracy lib/chef/resource/hostname.rb
Signed-off-by: Bernhard Ott <bernhard.ott@westernacher.com>
-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