diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-08-18 16:24:21 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-08-18 16:24:21 -0700 |
commit | 4f03c043d749f6caab625b27dd2d65f6f81ecfdd (patch) | |
tree | af20bda1c18cb15ff4c0538089e1bfa4ee9ac789 /lib/chef | |
parent | 621caccc151dfbdddb29adfec57aef91ff3d06c5 (diff) | |
download | chef-4f03c043d749f6caab625b27dd2d65f6f81ecfdd.tar.gz |
Use .error? and make sure not to raise too early
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/resource/timezone.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/resource/timezone.rb b/lib/chef/resource/timezone.rb index 7ed67860cd..01d6967283 100644 --- a/lib/chef/resource/timezone.rb +++ b/lib/chef/resource/timezone.rb @@ -75,7 +75,7 @@ class Chef # @return [String] timezone id def current_windows_tz tz_shellout = shell_out("tzutil /g") - raise "There was an error running the tzutil command" if tz_shellout.exitstatus == 1 + raise "There was an error running the tzutil command" if tz_shellout.error? tz_shellout.stdout.strip end @@ -85,8 +85,8 @@ class Chef # @since 16.5 # @return [String] timezone id def current_systemd_tz - tz_shellout = shell_out!(["/usr/bin/timedatectl", "status"]) - raise "There was an error running the timedatectl command" if tz_shellout.exitstatus == 1 + tz_shellout = shell_out(["/usr/bin/timedatectl", "status"]) + raise "There was an error running the timedatectl command" if tz_shellout.error? # https://rubular.com/r/eV68MX9XXbyG4k /Time zone: (.*) \(.*/.match(tz_shellout.stdout)[1] |