summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Albertson <lance@osuosl.org>2020-08-31 12:13:24 -0700
committerLance Albertson <lance@osuosl.org>2020-09-15 14:04:36 -0700
commite61b4c5b47c6552da204a87a1f25ff4ff77d7945 (patch)
tree146655d6f2c4bd784674d63afdd7f53237bed54f
parentd4e9a952237bb59e227000f375888679596566cb (diff)
downloadchef-e61b4c5b47c6552da204a87a1f25ff4ff77d7945.tar.gz
Move Chef::Dist to chef-utils for new resources
Signed-off-by: Lance Albertson <lance@osuosl.org>
-rw-r--r--chef-config/lib/chef-config/config.rb2
-rw-r--r--lib/chef/resource/chef_client_cron.rb4
-rw-r--r--lib/chef/resource/chef_client_launchd.rb34
-rw-r--r--lib/chef/resource/chef_client_trusted_certificate.rb6
4 files changed, 23 insertions, 23 deletions
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index 946046c8e2..58b60e5295 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -36,7 +36,7 @@ autoload :URI, "uri"
autoload :Addressable, "addressable/uri"
autoload :OpenSSL, "openssl"
autoload :YAML, "yaml"
-require "chef-utils/dist"
+require "chef-utils/dist" unless defined?(ChefUtils::Dist)
module ChefConfig
diff --git a/lib/chef/resource/chef_client_cron.rb b/lib/chef/resource/chef_client_cron.rb
index 1da8aaaabb..4dc1e1e5ad 100644
--- a/lib/chef/resource/chef_client_cron.rb
+++ b/lib/chef/resource/chef_client_cron.rb
@@ -15,7 +15,7 @@
#
require_relative "../resource"
-require "chef-utils/dist"
+require "chef-utils/dist" unless defined?(ChefUtils::Dist)
require_relative "helpers/cron_validations"
require "digest/md5" unless defined?(Digest::MD5)
@@ -139,7 +139,7 @@ class Chef
description: "A Hash containing additional arbitrary environment variables under which the cron job will be run in the form of `({'ENV_VARIABLE' => 'VALUE'})`."
property :nice, [Integer, String],
- description: "The process priority to run the #{Chef::Dist::CLIENT} process at. A value of -20 is the highest priority and 19 is the lowest priority.",
+ description: "The process priority to run the #{ChefUtils::Dist::Infra::CLIENT} process at. A value of -20 is the highest priority and 19 is the lowest priority.",
introduced: "16.5",
coerce: proc { |x| Integer(x) },
callbacks: { "should be an Integer between -20 and 19" => proc { |v| v >= -20 && v <= 19 } }
diff --git a/lib/chef/resource/chef_client_launchd.rb b/lib/chef/resource/chef_client_launchd.rb
index c33fa05876..68e6f7324b 100644
--- a/lib/chef/resource/chef_client_launchd.rb
+++ b/lib/chef/resource/chef_client_launchd.rb
@@ -15,7 +15,7 @@
#
require_relative "../resource"
-require_relative "../dist"
+require "chef-utils/dist" unless defined?(ChefUtils::Dist)
class Chef
class Resource
class ChefClientLaunchd < Chef::Resource
@@ -23,37 +23,37 @@ class Chef
provides :chef_client_launchd
- description "Use the **chef_client_launchd** resource to configure the #{Chef::Dist::PRODUCT} to run on a schedule."
+ description "Use the **chef_client_launchd** resource to configure the #{ChefUtils::Dist::Infra::PRODUCT} to run on a schedule."
introduced "16.5"
examples <<~DOC
- **Set the #{Chef::Dist::PRODUCT} to run on a schedule**:
+ **Set the #{ChefUtils::Dist::Infra::PRODUCT} to run on a schedule**:
```ruby
- chef_client_launchd 'Setup the #{Chef::Dist::PRODUCT} to run every 30 minutes' do
+ chef_client_launchd 'Setup the #{ChefUtils::Dist::Infra::PRODUCT} to run every 30 minutes' do
interval 30
action :enable
end
```
- **Disable the #{Chef::Dist::PRODUCT} running on a schedule**:
+ **Disable the #{ChefUtils::Dist::Infra::PRODUCT} running on a schedule**:
```ruby
- chef_client_launchd 'Prevent the #{Chef::Dist::PRODUCT} from running on a schedule' do
+ chef_client_launchd 'Prevent the #{ChefUtils::Dist::Infra::PRODUCT} from running on a schedule' do
action :disable
end
```
DOC
property :user, String,
- description: "The name of the user that #{Chef::Dist::PRODUCT} runs as.",
+ description: "The name of the user that #{ChefUtils::Dist::Infra::PRODUCT} runs as.",
default: "root"
property :working_directory, String,
- description: "The working directory to run the #{Chef::Dist::PRODUCT} from.",
+ description: "The working directory to run the #{ChefUtils::Dist::Infra::PRODUCT} from.",
default: "/var/root"
property :interval, [Integer, String],
- description: "Time in minutes between #{Chef::Dist::PRODUCT} executions.",
+ description: "Time in minutes between #{ChefUtils::Dist::Infra::PRODUCT} executions.",
coerce: proc { |x| Integer(x) },
callbacks: { "should be a positive number" => proc { |v| v > 0 } },
default: 30
@@ -62,7 +62,7 @@ class Chef
default: 300,
coerce: proc { |x| Integer(x) },
callbacks: { "should be a positive number" => proc { |v| v > 0 } },
- description: "A random number of seconds between 0 and X to add to interval so that all #{Chef::Dist::CLIENT} commands don't execute at the same time."
+ description: "A random number of seconds between 0 and X to add to interval so that all #{ChefUtils::Dist::Infra::CLIENT} commands don't execute at the same time."
property :accept_chef_license, [true, false],
description: "Accept the Chef Online Master License and Services Agreement. See <https://www.chef.io/online-master-agreement/>",
@@ -70,7 +70,7 @@ class Chef
property :config_directory, String,
description: "The path of the config directory.",
- default: Chef::Dist::CONF_DIR
+ default: ChefConfig::Config.etc_chef_dir
property :log_directory, String,
description: "The path of the directory to create the log file in.",
@@ -81,11 +81,11 @@ class Chef
default: "client.log"
property :chef_binary_path, String,
- description: "The path to the #{Chef::Dist::CLIENT} binary.",
- default: "/opt/#{Chef::Dist::DIR_SUFFIX}/bin/#{Chef::Dist::CLIENT}"
+ description: "The path to the #{ChefUtils::Dist::Infra::CLIENT} binary.",
+ default: "/opt/#{ChefUtils::Dist::Infra::DIR_SUFFIX}/bin/#{ChefUtils::Dist::Infra::CLIENT}"
property :daemon_options, Array,
- description: "An array of options to pass to the #{Chef::Dist::CLIENT} command.",
+ description: "An array of options to pass to the #{ChefUtils::Dist::Infra::CLIENT} command.",
default: lazy { [] }
property :environment, Hash,
@@ -93,12 +93,12 @@ class Chef
default: lazy { {} }
property :nice, [Integer, String],
- description: "The process priority to run the #{Chef::Dist::CLIENT} process at. A value of -20 is the highest priority and 19 is the lowest priority.",
+ description: "The process priority to run the #{ChefUtils::Dist::Infra::CLIENT} process at. A value of -20 is the highest priority and 19 is the lowest priority.",
coerce: proc { |x| Integer(x) },
callbacks: { "should be an Integer between -20 and 19" => proc { |v| v >= -20 && v <= 19 } }
property :low_priority_io, [true, false],
- description: "Run the #{Chef::Dist::CLIENT} process with low priority disk IO",
+ description: "Run the #{ChefUtils::Dist::Infra::CLIENT} process with low priority disk IO",
default: true
action :enable do
@@ -191,4 +191,4 @@ class Chef
end
end
end
-end \ No newline at end of file
+end
diff --git a/lib/chef/resource/chef_client_trusted_certificate.rb b/lib/chef/resource/chef_client_trusted_certificate.rb
index 855407b12a..b5272fbe01 100644
--- a/lib/chef/resource/chef_client_trusted_certificate.rb
+++ b/lib/chef/resource/chef_client_trusted_certificate.rb
@@ -15,7 +15,7 @@
#
require_relative "../resource"
-require_relative "../dist"
+require "chef-utils/dist" unless defined?(ChefUtils::Dist)
class Chef
class Resource
@@ -24,7 +24,7 @@ class Chef
provides :chef_client_trusted_certificate
- description "Use the **chef_client_trusted_certificate** resource to add certificates to #{Chef::Dist::PRODUCT}'s trusted certificate directory. This allows the #{Chef::Dist::PRODUCT} to communicate with internal encrypted resources without errors."
+ description "Use the **chef_client_trusted_certificate** resource to add certificates to #{ChefUtils::Dist::Infra::PRODUCT}'s trusted certificate directory. This allows the #{ChefUtils::Dist::Infra::PRODUCT} to communicate with internal encrypted resources without errors."
introduced "16.5"
examples <<~DOC
**Trust a self signed certificate**:
@@ -98,4 +98,4 @@ class Chef
end
end
end
-end \ No newline at end of file
+end