diff options
author | Marc Chamberland <mchamberland@pbsc.com> | 2019-05-05 20:40:46 -0400 |
---|---|---|
committer | Marc Chamberland <mchamberland@pbsc.com> | 2019-05-23 12:31:28 -0400 |
commit | 925c4c7d757404c7c68001bb928044cad0f5c2a8 (patch) | |
tree | b2ce5aeb86a6e3abc6eebfb7fba3aa98125ebe92 | |
parent | c08d0b8789b9ad5ac8082bef370d5cc6ae5b610f (diff) | |
download | chef-925c4c7d757404c7c68001bb928044cad0f5c2a8.tar.gz |
more distro constants for "Chef"
Signed-off-by: Marc Chamberland <mchamberland@pbsc.com>
-rw-r--r-- | lib/chef/application.rb | 2 | ||||
-rw-r--r-- | lib/chef/chef_fs/knife.rb | 3 | ||||
-rw-r--r-- | lib/chef/data_collector/run_end_message.rb | 3 | ||||
-rw-r--r-- | lib/chef/data_collector/run_start_message.rb | 3 | ||||
-rw-r--r-- | lib/chef/dist.rb | 10 | ||||
-rw-r--r-- | lib/chef/environment.rb | 2 | ||||
-rw-r--r-- | lib/chef/exceptions.rb | 2 | ||||
-rw-r--r-- | lib/chef/knife/bootstrap.rb | 2 | ||||
-rw-r--r-- | lib/chef/knife/bootstrap/chef_vault_handler.rb | 3 | ||||
-rw-r--r-- | lib/chef/knife/serve.rb | 4 | ||||
-rw-r--r-- | lib/chef/knife/status.rb | 3 | ||||
-rw-r--r-- | lib/chef/policy_builder/policyfile.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/file.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/cron_d.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/dsc_resource.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/file.rb | 2 | ||||
-rw-r--r-- | lib/chef/shell/ext.rb | 7 | ||||
-rw-r--r-- | spec/unit/environment_spec.rb | 2 |
18 files changed, 28 insertions, 28 deletions
diff --git a/lib/chef/application.rb b/lib/chef/application.rb index 3093d358ea..4ec3bac237 100644 --- a/lib/chef/application.rb +++ b/lib/chef/application.rb @@ -316,7 +316,7 @@ class Chef end def fork_chef_client - logger.info "Forking chef instance to converge..." + logger.info "Forking #{Chef::Dist::PRODUCT} instance to converge..." pid = fork do # Want to allow forked processes to finish converging when # TERM singal is received (exit gracefully) diff --git a/lib/chef/chef_fs/knife.rb b/lib/chef/chef_fs/knife.rb index 18a2958cb5..1d9a82fd51 100644 --- a/lib/chef/chef_fs/knife.rb +++ b/lib/chef/chef_fs/knife.rb @@ -18,6 +18,7 @@ require_relative "../knife" require "pathname" unless defined?(Pathname) +require "chef/dist" class Chef module ChefFS @@ -50,7 +51,7 @@ class Chef option :chef_repo_path, long: "--chef-repo-path PATH", - description: "Overrides the location of chef repo. Default is specified by chef_repo_path in the config" + description: "Overrides the location of #{Chef::Dist::PRODUCT} repo. Default is specified by chef_repo_path in the config" option :concurrency, long: "--concurrency THREADS", diff --git a/lib/chef/data_collector/run_end_message.rb b/lib/chef/data_collector/run_end_message.rb index f89639be8c..70a0b59650 100644 --- a/lib/chef/data_collector/run_end_message.rb +++ b/lib/chef/data_collector/run_end_message.rb @@ -16,7 +16,6 @@ # require_relative "message_helpers" -require_relative "../../dist" class Chef class DataCollector @@ -62,7 +61,7 @@ class Chef "policy_group" => node&.policy_group, "start_time" => run_status.start_time.utc.iso8601, "end_time" => run_status.end_time.utc.iso8601, - "source" => solo_run? ? Chef::Dist::SOLOEXEC : CHEF::DIST::CLIENT, + "source" => solo_run? ? "chef_solo" : "chef_client", "status" => status, "total_resource_count" => all_action_records(action_collection).count, "updated_resource_count" => updated_resource_count(action_collection), diff --git a/lib/chef/data_collector/run_start_message.rb b/lib/chef/data_collector/run_start_message.rb index 2fc7204194..fd070da8e4 100644 --- a/lib/chef/data_collector/run_start_message.rb +++ b/lib/chef/data_collector/run_start_message.rb @@ -16,7 +16,6 @@ # require_relative "message_helpers" -require_relative "../../dist" class Chef class DataCollector @@ -51,7 +50,7 @@ class Chef "node_name" => node&.name || data_collector.node_name, "organization_name" => organization, "run_id" => run_status&.run_id, - "source" => solo_run? ? Chef::Dist::SOLOEXEC : Chef::Dist::CLIENT, + "source" => solo_run? ? "chef_solo" : "chef_client", "start_time" => run_status.start_time.utc.iso8601, } end diff --git a/lib/chef/dist.rb b/lib/chef/dist.rb index 68205fb74d..f0b0f9b375 100644 --- a/lib/chef/dist.rb +++ b/lib/chef/dist.rb @@ -11,7 +11,7 @@ class Chef CLIENT = "chef-client".freeze # name of the automate product - AUTOMATE = "Chef Automate" + AUTOMATE = "Chef Automate".freeze # The chef executable, as in `chef gem install` or `chef generate cookbook` EXEC = "chef".freeze @@ -20,15 +20,15 @@ class Chef WEBSITE = "https://chef.io".freeze # Chef-Zero's product name - ZERO = "Chef Infra Zero" + ZERO = "Chef Infra Zero".freeze # Chef-Solo's product name - SOLO = "Chef Infra Solo" + SOLO = "Chef Infra Solo".freeze # The chef-zero executable (local mode) - ZEROEXEC = "chef-zero" + ZEROEXEC = "chef-zero".freeze # The chef-solo executable (legacy local mode) - SOLOEXEC = "chef-solo" + SOLOEXEC = "chef-solo".freeze end end diff --git a/lib/chef/environment.rb b/lib/chef/environment.rb index 7e1c583fa3..9dd1aa408a 100644 --- a/lib/chef/environment.rb +++ b/lib/chef/environment.rb @@ -25,7 +25,7 @@ require_relative "mixin/params_validate" require_relative "mixin/from_file" require_relative "version_constraint" require_relative "server_api" -require_relative "../dist" +require_relative "dist" class Chef class Environment diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb index de5c155c50..65ba0ae340 100644 --- a/lib/chef/exceptions.rb +++ b/lib/chef/exceptions.rb @@ -301,7 +301,7 @@ class Chef def client_run_failure(exception) set_backtrace(exception.backtrace) - @all_failures << [ "chef run", exception ] + @all_failures << [ "#{Chef::Dist::PRODUCT} run", exception ] end def notification_failure(exception) diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb index 58f79311ab..ae1bab3664 100644 --- a/lib/chef/knife/bootstrap.rb +++ b/lib/chef/knife/bootstrap.rb @@ -177,7 +177,7 @@ class Chef # client.rb content via bootstrap_context option :bootstrap_no_proxy, long: "--bootstrap-no-proxy [NO_PROXY_URL|NO_PROXY_IP]", - description: "Do not proxy locations for the node being bootstrapped; this option is used internally by #{Chef::Dist::PRODUCT}.", + description: "Do not proxy locations for the node being bootstrapped", proc: Proc.new { |np| Chef::Config[:knife][:bootstrap_no_proxy] = np } # client.rb content via bootstrap_context diff --git a/lib/chef/knife/bootstrap/chef_vault_handler.rb b/lib/chef/knife/bootstrap/chef_vault_handler.rb index 233350de73..605a9d359b 100644 --- a/lib/chef/knife/bootstrap/chef_vault_handler.rb +++ b/lib/chef/knife/bootstrap/chef_vault_handler.rb @@ -15,7 +15,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - class Chef class Knife class Bootstrap < Knife @@ -141,7 +140,7 @@ class Chef def require_chef_vault! @require_chef_vault ||= begin - error_message = "Knife bootstrap requires version 2.6.0 or higher of the chef-vault gem to configure chef vault items" + error_message = "Knife bootstrap requires version 2.6.0 or higher of the chef-vault gem to configure vault items" require "chef-vault" if Gem::Version.new(ChefVault::VERSION) < Gem::Version.new("2.6.0") raise error_message diff --git a/lib/chef/knife/serve.rb b/lib/chef/knife/serve.rb index 4bef044e11..cce2ff6576 100644 --- a/lib/chef/knife/serve.rb +++ b/lib/chef/knife/serve.rb @@ -26,11 +26,11 @@ class Chef option :repo_mode, long: "--repo-mode MODE", - description: "Specifies the local repository layout. Values: static (only environments/roles/data_bags/cookbooks), everything (includes nodes/clients/users), hosted_everything (includes acls/groups/etc. for Enterprise/Hosted #{Chef::Dist::PRODUCT}). Default: everything/hosted_everything." + description: "Specifies the local repository layout. Values: static (only environments/roles/data_bags/cookbooks), everything (includes nodes/clients/users), hosted_everything (includes acls/groups/etc. for Enterprise/Hosted Chef). Default: everything/hosted_everything." option :chef_repo_path, long: "--chef-repo-path PATH", - description: "Overrides the location of chef repo. Default is specified by chef_repo_path in the config." + description: "Overrides the location of #{Chef::Dist::PRODUCT} repo. Default is specified by chef_repo_path in the config." option :chef_zero_host, long: "--chef-zero-host IP", diff --git a/lib/chef/knife/status.rb b/lib/chef/knife/status.rb index 4e51b4a2ad..074488e003 100644 --- a/lib/chef/knife/status.rb +++ b/lib/chef/knife/status.rb @@ -19,6 +19,7 @@ require_relative "../knife" require_relative "core/status_presenter" require_relative "core/node_presenter" +require_relative "../dist" class Chef class Knife @@ -43,7 +44,7 @@ class Chef option :hide_by_mins, long: "--hide-by-mins MINS", - description: "Hide nodes that have run chef in the last MINS minutes" + description: "Hide nodes that have run #{Chef::Dist::CLIENT} in the last MINS minutes" def append_to_query(term) @query << " AND " unless @query.empty? diff --git a/lib/chef/policy_builder/policyfile.rb b/lib/chef/policy_builder/policyfile.rb index 353365941c..e60457e145 100644 --- a/lib/chef/policy_builder/policyfile.rb +++ b/lib/chef/policy_builder/policyfile.rb @@ -103,7 +103,7 @@ class Chef end if Chef::Config[:environment] && !Chef::Config[:environment].chomp.empty? - raise UnsupportedFeature, "Policyfile does not work with #{Chef::Dist::PRODUCT} Environments." + raise UnsupportedFeature, "Policyfile does not work with an Environment configured." end end diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb index 8c7055f107..bf38a36a6a 100644 --- a/lib/chef/provider/file.rb +++ b/lib/chef/provider/file.rb @@ -230,7 +230,7 @@ class Chef elsif file_class.symlink?(new_resource.path) && new_resource.manage_symlink_source.nil? logger.warn("File #{path} managed by #{new_resource} is really a symlink (to #{file_class.realpath(new_resource.path)}). Managing the source file instead.") logger.warn("Disable this warning by setting `manage_symlink_source true` on the resource") - logger.warn("In a future #{Chef::Dist::PRODUCT} release, 'manage_symlink_source' will not be enabled by default") + logger.warn("In a future release, 'manage_symlink_source' will not be enabled by default") verify_symlink_sanity(path) elsif new_resource.force_unlink [nil, nil, nil] diff --git a/lib/chef/resource/cron_d.rb b/lib/chef/resource/cron_d.rb index c58de5285c..8dfa810ad9 100644 --- a/lib/chef/resource/cron_d.rb +++ b/lib/chef/resource/cron_d.rb @@ -163,7 +163,7 @@ class Chef # warn if someone passes the deprecated cookbook property def after_created - raise ArgumentError, "The 'cookbook' property for the cron_d resource is no longer supported now that this resource ships in #{Chef::Dist::PRODUCT} itself." if cookbook + raise ArgumentError, "The 'cookbook' property for the cron_d resource is no longer supported now that it ships as a core resource." if cookbook end action :create do diff --git a/lib/chef/resource/dsc_resource.rb b/lib/chef/resource/dsc_resource.rb index 5df4cae498..79ed42c60e 100644 --- a/lib/chef/resource/dsc_resource.rb +++ b/lib/chef/resource/dsc_resource.rb @@ -24,7 +24,7 @@ class Chef resource_name :dsc_resource provides :dsc_resource - description "The dsc_resource resource allows any DSC resource to be used in a #{Chef::Dist::PRODUCT} recipe, as well as any custom resources that have been added to your Windows PowerShell environment. Microsoft frequently adds new resources to the DSC resource collection." + description "The dsc_resource resource allows any DSC resource to be used in a recipe, as well as any custom resources that have been added to your Windows PowerShell environment. Microsoft frequently adds new resources to the DSC resource collection." introduced "12.2" # This class will check if the object responds to diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb index 310cd91830..0bfd57ea7f 100644 --- a/lib/chef/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -73,7 +73,7 @@ class Chef description: "How the #{Chef::Dist::CLIENT} handles certain situations when the target file turns out not to be a file. For example, when a target file is actually a symlink. Set to true for the #{Chef::Dist::CLIENT} delete the non-file target and replace it with the specified file. Set to false for the #{Chef::Dist::CLIENT} to raise an error." property :manage_symlink_source, [ TrueClass, FalseClass ], desired_state: false, - description: "Change the behavior of the file resource if it is pointed at a symlink. When this value is set to true, the Chef client will manage the symlink's permissions or will replace the symlink with a normal file if the resource has content. When this value is set to false, #{Chef::Dist::PRODUCT} will follow the symlink and will manage the permissions and content of symlink's target file. The default behavior is true but emits a warning that the default value will be changed to false in a future version; setting this explicitly to true or false suppresses this warning." + description: "Change the behavior of the file resource if it is pointed at a symlink. When this value is set to true, #{Chef::Dist::PRODUCT} will manage the symlink's permissions or will replace the symlink with a normal file if the resource has content. When this value is set to false, #{Chef::Dist::PRODUCT} will follow the symlink and will manage the permissions and content of symlink's target file. The default behavior is true but emits a warning that the default value will be changed to false in a future version; setting this explicitly to true or false suppresses this warning." property :verifications, Array, default: lazy { [] } diff --git a/lib/chef/shell/ext.rb b/lib/chef/shell/ext.rb index 7bd3ec31d1..e520704231 100644 --- a/lib/chef/shell/ext.rb +++ b/lib/chef/shell/ext.rb @@ -25,6 +25,7 @@ require_relative "shell_session" require_relative "model_wrapper" require_relative "../server_api" require_relative "../json_compat" +require_relative "../dist" module Shell module Extensions @@ -229,7 +230,7 @@ module Shell :attributes end - desc "run chef using the current recipe" + desc "run #{Chef::Dist::PRODUCT} using the current recipe" def run_chef Chef::Log.level = :debug session = Shell.session @@ -238,8 +239,8 @@ module Shell runrun end - desc "returns an object to control a paused chef run" - subcommands resume: "resume the chef run", + desc "returns an object to control a paused #{Chef::Dist::PRODUCT} run" + subcommands resume: "resume the #{Chef::Dist::PRODUCT} run", step: "run only the next resource", skip_back: "move back in the run list", skip_forward: "move forward in the run list" diff --git a/spec/unit/environment_spec.rb b/spec/unit/environment_spec.rb index 07d8f5f552..467b719bb7 100644 --- a/spec/unit/environment_spec.rb +++ b/spec/unit/environment_spec.rb @@ -299,7 +299,7 @@ describe Chef::Environment do expect do Chef::Environment.validate_cookbook_version("= 1.2.3.4") end.to raise_error Chef::Exceptions::IllegalVersionConstraint, - "Environment cookbook version constraints not allowed in .*" + /Environment cookbook version constraints not allowed in .*/ end end |