summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraklyachkin <aklyachkin@gmail.com>2020-05-07 09:54:16 +0200
committerTim Smith <tsmith84@gmail.com>2020-05-28 13:08:28 -0700
commitb15f37656b3993b77a65c8cfbd7e6300a9b3e604 (patch)
tree9ca5755f6ef1779c77886f5ed7f11d972a7a5049
parent44c89fc37d3f8ddd51a15ff0fea512cafebaf7f4 (diff)
downloadchef-b15f37656b3993b77a65c8cfbd7e6300a9b3e604.tar.gz
changed according to suggestion of @phiggins
Signed-off-by: aklyachkin <aklyachkin@gmail.com>
-rw-r--r--lib/chef/resource/cron_access.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/chef/resource/cron_access.rb b/lib/chef/resource/cron_access.rb
index b451aed39b..51348c2ada 100644
--- a/lib/chef/resource/cron_access.rb
+++ b/lib/chef/resource/cron_access.rb
@@ -58,13 +58,15 @@ class Chef
description: "An optional property to set the user name if it differs from the resource block's name.",
name_property: true
+ CRON_PATHS = {
+ 'aix' => '/var/adm/cron',
+ 'solaris' => '/etc/cron.d',
+ 'default' => '/etc'
+ }
+
action :allow do
description "Add the user to the cron.allow file."
- allow_path = value_for_platform_family(
- 'aix' => '/var/adm/cron/cron.allow',
- 'solaris' => '/etc/cron.d/cron.allow',
- 'default' => '/etc/cron.allow'
- )
+ allow_path = File.join(value_for_platform_family(CRON_PATHS), "cron.allow")
with_run_context :root do
edit_resource(:template, allow_path) do |new_resource|
@@ -81,11 +83,7 @@ class Chef
action :deny do
description "Add the user to the cron.deny file."
- deny_path = value_for_platform_family(
- 'aix' => '/var/adm/cron/cron.deny',
- 'solaris' => '/etc/cron.d/cron.deny',
- 'default' => '/etc/cron.deny'
- )
+ deny_path = File.join(value_for_platform_family(CRON_PATHS), "cron.deny")
with_run_context :root do
edit_resource(:template, deny_path) do |new_resource|