summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraklyachkin <aklyachkin@gmail.com>2020-05-04 11:42:57 +0200
committerTim Smith <tsmith84@gmail.com>2020-06-23 09:11:32 -0700
commit4e3179a0f600de7cca28c1f24d8eea319ad56703 (patch)
tree16f3f9a36983da19427c265f62693eac6d4e58e9
parent461ec1574d59780dfc91bd3b0520072221fb216d (diff)
downloadchef-4e3179a0f600de7cca28c1f24d8eea319ad56703.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 9939437a2d..7f0a68d913 100644
--- a/lib/chef/resource/cron_access.rb
+++ b/lib/chef/resource/cron_access.rb
@@ -27,7 +27,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."
+ 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
```ruby
@@ -56,9 +56,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"
@@ -72,9 +77,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"