summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-05-28 13:32:35 -0700
committerTim Smith <tsmith84@gmail.com>2020-05-28 13:32:35 -0700
commit7abfad55ffe636e0b6adb44e6c1a24407034e718 (patch)
tree7e0cb4c1e04c69d999b330e7eece1703f6216fc2 /lib
parentb15f37656b3993b77a65c8cfbd7e6300a9b3e604 (diff)
downloadchef-7abfad55ffe636e0b6adb44e6c1a24407034e718.tar.gz
hostname: Remove support for Solaris 5.10
We don't support Solaris 5.10 in Chef anymore so there's no reason to make this check every time the resource runs on Solaris 5.11 Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/resource/hostname.rb19
1 files changed, 1 insertions, 18 deletions
diff --git a/lib/chef/resource/hostname.rb b/lib/chef/resource/hostname.rb
index 41dc80d1bf..f398777459 100644
--- a/lib/chef/resource/hostname.rb
+++ b/lib/chef/resource/hostname.rb
@@ -199,24 +199,7 @@ class Chef
group node["root_group"]
mode "0644"
end
- when ::File.exist?("/etc/nodename")
- # Solaris <= 5.10 systems prior to svccfg taking over this functionality (must come before svccfg handling)
- declare_resource(:file, "/etc/nodename") do
- content "#{new_resource.hostname}\n"
- owner "root"
- group node["root_group"]
- mode "0644"
- end
- # Solaris also has /etc/inet/hosts (copypasta alert)
- unless new_resource.ipaddress.nil?
- newline = "#{new_resource.ipaddress} #{new_resource.hostname}"
- newline << " #{new_resource.aliases.join(" ")}" if new_resource.aliases && !new_resource.aliases.empty?
- newline << " #{new_resource.hostname[/[^\.]*/]}"
- r = append_replacing_matching_lines("/etc/inet/hosts", /^#{new_resource.ipaddress}\s+|\s+#{new_resource.hostname}\s+/, newline)
- r.notifies :reload, "ohai[reload hostname]"
- end
- when ::File.exist?("/usr/sbin/svccfg")
- # Solaris >= 5.11 systems using svccfg (must come after /etc/nodename handling)
+ when ::File.exist?("/usr/sbin/svccfg") # solaris 5.11
declare_resource(:execute, "svccfg -s system/identity:node setprop config/nodename=\'#{new_resource.hostname}\'") do
notifies :run, "execute[svcadm refresh]", :immediately
notifies :run, "execute[svcadm restart]", :immediately