diff options
author | aklyachkin <aklyachkin@gmail.com> | 2020-05-07 09:54:16 +0200 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-06-23 09:11:48 -0700 |
commit | 486c5e6794301271cb1ee029435467421bb2a498 (patch) | |
tree | 81ed60e34d476a04298456916d1c01fcbd962896 | |
parent | 4e3179a0f600de7cca28c1f24d8eea319ad56703 (diff) | |
download | chef-486c5e6794301271cb1ee029435467421bb2a498.tar.gz |
changed according to suggestion of @phiggins
Signed-off-by: aklyachkin <aklyachkin@gmail.com>
-rw-r--r-- | lib/chef/resource/cron_access.rb | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/chef/resource/cron_access.rb b/lib/chef/resource/cron_access.rb index 7f0a68d913..da91f8d6c4 100644 --- a/lib/chef/resource/cron_access.rb +++ b/lib/chef/resource/cron_access.rb @@ -54,13 +54,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| @@ -77,11 +79,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| |