diff options
author | Tim Smith <tsmith@chef.io> | 2020-05-28 17:14:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-28 17:14:18 -0700 |
commit | 4669d57469dff2257995591a45dd17eeb0401832 (patch) | |
tree | 0f5932ddd40a9918fe287e5596ff59fce52a2dbe | |
parent | 730942d8fd2ee8cbdd6c4c00ba0d7b3ba0a90769 (diff) | |
parent | 2760e9cdcd210ad82ca13b24d599ea75ec067e8c (diff) | |
download | chef-4669d57469dff2257995591a45dd17eeb0401832.tar.gz |
Merge pull request #9928 from chef/hostname_solaris
hostname: Remove support for Solaris 5.10
-rw-r--r-- | lib/chef/resource/hostname.rb | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/lib/chef/resource/hostname.rb b/lib/chef/resource/hostname.rb index 41dc80d1bf..2d9b18b42d 100644 --- a/lib/chef/resource/hostname.rb +++ b/lib/chef/resource/hostname.rb @@ -1,4 +1,7 @@ # +# Copyright:: Copyright (c) Chef Software Inc. +# License:: Apache License, Version 2.0 +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -199,24 +202,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 |