summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-10-09 12:46:03 -0700
committerTim Smith <tsmith@chef.io>2018-10-09 12:46:03 -0700
commite44a1efd5f5855495b17b8b48d00954753678cbd (patch)
treebe51c4cf65a0cae4c19c8978013e026ff11a4489
parent9c92baeba900ffb0b62b35da9bcae5390d511baa (diff)
downloadchef-e44a1efd5f5855495b17b8b48d00954753678cbd.tar.gz
Shellout with an array for safet
Simplifies this code a bit, but it also the safe thing to do in the event that the timezone has a space. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/timezone.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/chef/resource/timezone.rb b/lib/chef/resource/timezone.rb
index 0f12a82617..8834e2404f 100644
--- a/lib/chef/resource/timezone.rb
+++ b/lib/chef/resource/timezone.rb
@@ -41,11 +41,7 @@ class Chef
if node["init_package"] == "systemd"
# Modern Amazon, Fedora, CentOS, RHEL, Ubuntu & Debian
- cmd_set_tz = "/usr/bin/timedatectl"
- cmd_set_tz += " "
- cmd_set_tz += "--no-ask-password"
- cmd_set_tz += " "
- cmd_set_tz += "set-timezone #{new_resource.timezone}"
+ cmd_set_tz = "/usr/bin/timedatectl --no-ask-password set-timezone #{new_resource.timezone}"
cmd_check_if_set = "/usr/bin/timedatectl status"
cmd_check_if_set += " | /usr/bin/awk '/Time.*zone/{print}'"