class Chef::Resource::Timezone
Public Instance Methods
current_darwin_tz()
click to toggle source
detect the current TZ on darwin hosts
@since 14.7 @return [String] TZ database value
# File lib/chef/resource/timezone.rb, line 113 def current_darwin_tz tz_shellout = shell_out!("systemsetup -gettimezone") if /You need administrator access/.match?(tz_shellout.stdout) raise "The timezone resource requires adminstrative priveleges to run on macOS hosts!" else /Time Zone: (.*)/.match(tz_shellout.stdout)[1] end end
current_windows_tz()
click to toggle source
detect the current timezone on windows hosts
@since 14.7 @return [String] timezone id
# File lib/chef/resource/timezone.rb, line 126 def current_windows_tz tz_shellout = shell_out("tzutil /g") raise "There was an error running the tzutil command" if tz_shellout.exitstatus == 1 tz_shellout.stdout.strip end