summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-03-06 11:56:53 -0800
committerGitHub <noreply@github.com>2020-03-06 11:56:53 -0800
commitf11019af0b420e9425e42b16d1df37c7b4a8d23f (patch)
tree18e2bb72e372364649bb1acc18138e08d14e31e1
parentf183fc75819a0ea6bae49903ee4a838b2bc02bd5 (diff)
parent8daae9f0631d53b36d0ea30b5562263e74409410 (diff)
downloadchef-f11019af0b420e9425e42b16d1df37c7b4a8d23f.tar.gz
Merge pull request #9452 from chef/timezone
timezone: Remove support for ubuntu < 16.04 / Debian < 8
-rw-r--r--lib/chef/resource/timezone.rb21
1 files changed, 4 insertions, 17 deletions
diff --git a/lib/chef/resource/timezone.rb b/lib/chef/resource/timezone.rb
index 63eed848ab..afbef3818f 100644
--- a/lib/chef/resource/timezone.rb
+++ b/lib/chef/resource/timezone.rb
@@ -37,14 +37,14 @@ class Chef
description "Set the timezone."
# some linux systems may be missing the timezone data
- if node["os"] == "linux"
+ if linux?
package "tzdata" do
- package_name platform_family?("suse") ? "timezone" : "tzdata"
+ package_name suse? ? "timezone" : "tzdata"
end
end
- # Modern Amazon, Fedora, RHEL, Ubuntu & Debian
- if node["init_package"] == "systemd"
+ # Modern SUSE, Amazon, Fedora, RHEL, Ubuntu & Debian
+ if systemd?
cmd_set_tz = "/usr/bin/timedatectl --no-ask-password set-timezone #{new_resource.timezone}"
cmd_check_if_set = "/usr/bin/timedatectl status"
@@ -78,19 +78,6 @@ class Chef
to "/usr/share/zoneinfo/#{new_resource.timezone}"
not_if { ::File.executable?("/usr/sbin/tzdata-update") }
end
- # debian < 8 and Ubuntu < 16.04
- when "debian"
- file "/etc/timezone" do
- action :create
- content "#{new_resource.timezone}\n"
- end
-
- bash "dpkg-reconfigure tzdata" do
- user "root"
- code "/usr/sbin/dpkg-reconfigure -f noninteractive tzdata"
- action :nothing
- subscribes :run, "file[/etc/timezone]", :immediately
- end
when "mac_os_x"
unless current_darwin_tz == new_resource.timezone
converge_by("set timezone to #{new_resource.timezone}") do