Skip to content

add solaris2 support #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
7 changes: 6 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
default.tz = 'UTC'

# Path to tzdata directory
default.timezone.tzdata_dir = '/usr/share/zoneinfo'
case node.platform_family
when 'solaris2'
default.timezone.tzdata_dir = '/usr/share/lib/zoneinfo'
else
default.timezone.tzdata_dir = '/usr/share/zoneinfo'
end

# Path to file used by kernel for local timezone's data
default.timezone.localtime_path = '/etc/localtime'
Expand Down
2 changes: 1 addition & 1 deletion files/default/tests/minitest/default_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class TimezoneIiSpec < MiniTest::Chef::Spec
describe_recipe 'timezone-ii::default' do

it 'updates the timezone' do
IO.read('/etc/localtime').must_equal IO.read("/usr/share/zoneinfo/#{node[:tz]}")
IO.read('/etc/localtime').must_equal IO.read("#{node[:timezone][:tzdata_dir]}/#{node[:tz]}")
end

end
Expand Down
1 change: 1 addition & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
supports "ubuntu"
supports "pld"
supports "rhel"
supports "solaris2"
3 changes: 2 additions & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
# timekeeping field is forever in your debt.)
package value_for_platform_family(
'gentoo' => 'timezone-data',
'solaris2' => 'timezone',
'default' => 'tzdata'
)

case node.platform_family
when 'debian', 'fedora', 'pld', 'rhel'
when 'debian', 'fedora', 'pld', 'rhel', 'solaris2'
include_recipe "timezone-ii::#{node.platform_family}"

else
Expand Down
6 changes: 6 additions & 0 deletions recipes/solaris2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
execute "set_timezone" do
command "svccfg -s timezone:default setprop timezone/localtime= astring: #{node['tz']}; svcadm refresh timezone:default"
not_if "svccfg -s timezone:default listprop timezone/localtime | grep #{node['tz']}"
action :run
end