Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,37 @@
'default' => 'tzdata'
)

case node.platform_family
case node['platform_family']
when 'rhel'
include_recipe value_for_platform(
'amazon' => { 'default' => 'timezone-ii::amazon' },
'default' => 'timezone-ii::rhel'
)

when 'debian', 'fedora', 'pld'
include_recipe "timezone-ii::#{node.platform_family}"
include_recipe "timezone-ii::#{node['platform_family']}"

else
if node.os == "linux"
if node['os'] == "linux"
# Load the generic Linux recipe if there's no better known way to change the
# timezone. Log a warning (unless this is known to be the best way on a
# particular platform).
message = "Linux platform '#{node.platform}' is unknown to this recipe; " +
message = "Linux platform '#{node['platform']}' is unknown to this recipe; " +
"using generic Linux method"
log message do
level :warn
not_if { %w( centos gentoo rhel ).include? node.platform_family }
not_if { %w( centos gentoo rhel ).include? node['platform_family'] }
end

include_recipe 'timezone-ii::linux-generic'

else
message = "Don't know how to configure timezone for " +
"'#{node.platform_family}'!"
"'#{node['platform_family']}'!"
log message do
level :error
end

end # if/else node.os
end # if/else node['os']

end # case node.platform_family
end # case node['platform_family']
8 changes: 4 additions & 4 deletions recipes/linux-generic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# Generic timezone-changing method for Linux that should work for any distro
# without a platform-specific method.

timezone_data_file = File.join(node.timezone.tzdata_dir, node.tz)
localtime_path = node.timezone.localtime_path
timezone_data_file = File.join(node['timezone']['tzdata_dir'], node['tz'])
localtime_path = node['timezone']['localtime_path']

ruby_block "confirm timezone" do
block {
Expand All @@ -21,7 +21,7 @@
}
end

if node.timezone.use_symlink
if node['timezone']['use_symlink']
link localtime_path do
to timezone_data_file
owner 'root'
Expand All @@ -41,4 +41,4 @@
" or set attribute ['timezone']['use_symlink']=true"
}
end
end # if/else node.timezone.use_symlink
end # if/else node['timezone']['use_symlink']
2 changes: 1 addition & 1 deletion recipes/rhel7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
#

# This sets the timezone on EL 7 distributions (e.g. RedHat and CentOS)
execute "timedatectl --no-ask-password set-timezone #{node[:tz]}"
execute "timedatectl --no-ask-password set-timezone #{node['tz']}"