diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-05-16 09:29:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-16 09:29:10 -0700 |
commit | 7c2950ef5fcafc127b700cba123d57b5e6273c21 (patch) | |
tree | 96e6257b990be5453ce491f72ee42bbcc8678c9f /lib/chef | |
parent | d9346c56d0ca8f18cef61cb9d2581886b300d26f (diff) | |
parent | ab3a6d2af400fa09e4111e7ed3eb4dcc85a91acd (diff) | |
download | chef-7c2950ef5fcafc127b700cba123d57b5e6273c21.tar.gz |
Merge pull request #7262 from bottkv488/fix_resource_hostname
improved regex accuracy lib/chef/resource/hostname.rb
Diffstat (limited to 'lib/chef')
-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 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 |