summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraklyachkin <aklyachkin@gmail.com>2020-05-04 11:42:57 +0200
committerTim Smith <tsmith84@gmail.com>2020-05-28 13:08:26 -0700
commit44c89fc37d3f8ddd51a15ff0fea512cafebaf7f4 (patch)
tree3ec93b924200bdb6def425d944c118a30781213d
parentca748e29ae45bff15a2906c8055a2e22b5866f74 (diff)
downloadchef-44c89fc37d3f8ddd51a15ff0fea512cafebaf7f4.tar.gz
support for AIX and Solaris in cron_allow resource
Signed-off-by: aklyachkin <aklyachkin@gmail.com>
-rw-r--r--lib/chef/resource/cron_access.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/chef/resource/cron_access.rb b/lib/chef/resource/cron_access.rb
index f0e5ed64bf..b451aed39b 100644
--- a/lib/chef/resource/cron_access.rb
+++ b/lib/chef/resource/cron_access.rb
@@ -28,7 +28,7 @@ class Chef
provides(:cron_manage) # legacy name @todo in Chef 15 we should { true } this so it wins over the cookbook
introduced "14.4"
- description "Use the **cron_access** resource to manage the /etc/cron.allow and /etc/cron.deny files. Note: This resource previously shipped in the `cron` cookbook as `cron_manage`, which it can still be used as for backwards compatibility with existing Chef Infra Client releases."
+ description "Use the **cron_access** resource to manage cron's cron.allow and cron.deny files. Note: This resource previously shipped in the `cron` cookbook as `cron_manage`, which it can still be used as for backwards compatibility with existing Chef Infra Client releases."
examples <<~DOC
**Add the mike user to cron.allow**
@@ -60,9 +60,14 @@ class Chef
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'
+ )
with_run_context :root do
- edit_resource(:template, "/etc/cron.allow") do |new_resource|
+ edit_resource(:template, allow_path) do |new_resource|
source ::File.expand_path("../support/cron_access.erb", __FILE__)
local true
mode "0600"
@@ -76,9 +81,14 @@ 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'
+ )
with_run_context :root do
- edit_resource(:template, "/etc/cron.deny") do |new_resource|
+ edit_resource(:template, deny_path) do |new_resource|
source ::File.expand_path("../support/cron_access.erb", __FILE__)
local true
mode "0600"