diff options
author | Marc Chamberland <chamberland.marc@gmail.com> | 2020-05-09 22:58:18 -0400 |
---|---|---|
committer | Lance Albertson <lance@osuosl.org> | 2020-09-15 14:04:36 -0700 |
commit | ed48186831835be81b436a160bcf190a7756d473 (patch) | |
tree | d4ae8196171c57dc2e773e610997e5894e5cf019 /chef-config | |
parent | f5bbe608321ce3bcfd2d4f17292cf8c1ff042893 (diff) | |
download | chef-ed48186831835be81b436a160bcf190a7756d473.tar.gz |
move dist implementation into chef-utils
Signed-off-by: Marc Chamberland <chamberland.marc@gmail.com>
Signed-off-by: Lance Albertson <lance@osuosl.org>
Diffstat (limited to 'chef-config')
-rw-r--r-- | chef-config/lib/chef-config/config.rb | 21 | ||||
-rw-r--r-- | chef-config/lib/chef-config/mixin/credentials.rb | 4 | ||||
-rw-r--r-- | chef-config/lib/chef-config/workstation_config_loader.rb | 6 |
3 files changed, 15 insertions, 16 deletions
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb index 2c4323db82..1254911e35 100644 --- a/chef-config/lib/chef-config/config.rb +++ b/chef-config/lib/chef-config/config.rb @@ -36,7 +36,6 @@ autoload :URI, "uri" autoload :Addressable, "addressable/uri" autoload :OpenSSL, "openssl" autoload :YAML, "yaml" -require_relative "dist" module ChefConfig @@ -82,7 +81,7 @@ module ChefConfig # @return [String] the platform-specific path # def self.etc_chef_dir(windows: ChefUtils.windows?) - path = windows ? c_chef_dir : PathHelper.join("/etc", ChefConfig::Dist::DIR_SUFFIX, windows: windows) + path = windows ? c_chef_dir : PathHelper.join("/etc", ChefUtils::Dist::Infra::DIR_SUFFIX, windows: windows) PathHelper.cleanpath(path, windows: windows) end @@ -92,7 +91,7 @@ module ChefConfig # @return [String] the platform-specific path # def self.var_chef_dir(windows: ChefUtils.windows?) - path = windows ? c_chef_dir : PathHelper.join("/var", ChefConfig::Dist::DIR_SUFFIX, windows: windows) + path = windows ? c_chef_dir : PathHelper.join("/var", ChefUtils::Dist::Infra::DIR_SUFFIX, windows: windows) PathHelper.cleanpath(path, windows: windows) end @@ -114,7 +113,7 @@ module ChefConfig # def self.c_chef_dir(windows: ChefUtils.windows?) drive = windows_installation_drive || "C:" - PathHelper.join(drive, ChefConfig::Dist::DIR_SUFFIX, windows: windows) + PathHelper.join(drive, ChefUtils::Dist::Infra::DIR_SUFFIX, windows: windows) end # On windows, C:/opscode @@ -125,7 +124,7 @@ module ChefConfig # def self.c_opscode_dir(windows: ChefUtils.windows?) drive = windows_installation_drive || "C:" - PathHelper.join(drive, ChefConfig::Dist::LEGACY_CONF_DIR, ChefConfig::Dist::DIR_SUFFIX, windows: windows) + PathHelper.join(drive, ChefConfig::Dist::LEGACY_CONF_DIR, ChefUtils::Dist::Infra::DIR_SUFFIX, windows: windows) end # the drive where Chef is installed on a windows host. This is determined @@ -190,7 +189,7 @@ module ChefConfig if config_file PathHelper.dirname(PathHelper.canonical_path(config_file, false)) else - PathHelper.join(PathHelper.cleanpath(user_home), ChefConfig::Dist::USER_CONF_DIR, "") + PathHelper.join(PathHelper.cleanpath(user_home), ChefUtils::Dist::Infra::USER_CONF_DIR, "") end end @@ -269,7 +268,7 @@ module ChefConfig end path = new_path end - ChefConfig.logger.info("Auto-discovered #{ChefConfig::Dist::SHORT} repository at #{path}") + ChefConfig.logger.info("Auto-discovered #{ChefUtils::Dist::Infra::SHORT} repository at #{path}") path end @@ -398,7 +397,7 @@ module ChefConfig # If your `file_cache_path` resides on a NFS (or non-flock()-supporting # fs), it's recommended to set this to something like # '/tmp/chef-client-running.pid' - default(:lockfile) { PathHelper.join(file_cache_path, "#{ChefConfig::Dist::CLIENT}-running.pid") } + default(:lockfile) { PathHelper.join(file_cache_path, "#{ChefUtils::Dist::Infra::CLIENT}-running.pid") } ## Daemonization Settings ## # What user should Chef run as? @@ -795,7 +794,7 @@ module ChefConfig if chef_server_url.to_s =~ %r{/organizations/(.*)$} "#{$1}-validator" else - "#{ChefConfig::Dist::SHORT}-validator" + "#{ChefUtils::Dist::Infra::SHORT}-validator" end end @@ -869,7 +868,7 @@ module ChefConfig default :profile, nil default :chef_guid_path do - PathHelper.join(config_dir, "#{ChefConfig::Dist::SHORT}_guid") + PathHelper.join(config_dir, "#{ChefUtils::Dist::Infra::SHORT}_guid") end default :chef_guid, nil @@ -1078,7 +1077,7 @@ module ChefConfig # generated by the DataCollector when Chef is run in Solo mode. This # allows users to associate their Solo nodes with faux organizations # without the nodes being connected to an actual Chef Server. - default :organization, "#{ChefConfig::Dist::SHORT}_solo" + default :organization, "#{ChefUtils::Dist::Infra::SHORT}_solo" end configurable(:http_proxy) diff --git a/chef-config/lib/chef-config/mixin/credentials.rb b/chef-config/lib/chef-config/mixin/credentials.rb index de004a062f..b7c83a7611 100644 --- a/chef-config/lib/chef-config/mixin/credentials.rb +++ b/chef-config/lib/chef-config/mixin/credentials.rb @@ -36,7 +36,7 @@ module ChefConfig # normally set via a command-line option. # @return [String] def credentials_profile(profile = nil) - context_file = PathHelper.home(ChefConfig::Dist::USER_CONF_DIR, "context").freeze + context_file = PathHelper.home(ChefUtils::Dist::Infra::USER_CONF_DIR, "context").freeze if !profile.nil? profile elsif ENV.include?("CHEF_PROFILE") @@ -53,7 +53,7 @@ module ChefConfig # @since 14.4 # @return [String] def credentials_file_path - PathHelper.home(ChefConfig::Dist::USER_CONF_DIR, "credentials").freeze + PathHelper.home(ChefUtils::Dist::Infra::USER_CONF_DIR, "credentials").freeze end # Load and parse the credentials file. diff --git a/chef-config/lib/chef-config/workstation_config_loader.rb b/chef-config/lib/chef-config/workstation_config_loader.rb index 4e44a24fd7..8f481a7a89 100644 --- a/chef-config/lib/chef-config/workstation_config_loader.rb +++ b/chef-config/lib/chef-config/workstation_config_loader.rb @@ -59,7 +59,7 @@ module ChefConfig @chef_config_dir = false full_path = working_directory.split(File::SEPARATOR) (full_path.length - 1).downto(0) do |i| - candidate_directory = File.join(full_path[0..i] + [ChefConfig::Dist::USER_CONF_DIR]) + candidate_directory = File.join(full_path[0..i] + [ChefUtils::Dist::Infra::USER_CONF_DIR]) if File.exist?(candidate_directory) && File.directory?(candidate_directory) @chef_config_dir = candidate_directory break @@ -129,7 +129,7 @@ module ChefConfig candidate_configs << File.join(chef_config_dir, "knife.rb") end # Look for $HOME/.chef/knife.rb - PathHelper.home(ChefConfig::Dist::USER_CONF_DIR) do |dot_chef_dir| + PathHelper.home(ChefUtils::Dist::Infra::USER_CONF_DIR) do |dot_chef_dir| candidate_configs << File.join(dot_chef_dir, "config.rb") candidate_configs << File.join(dot_chef_dir, "knife.rb") end @@ -184,7 +184,7 @@ module ChefConfig end def home_chef_dir - @home_chef_dir ||= PathHelper.home(ChefConfig::Dist::USER_CONF_DIR) + @home_chef_dir ||= PathHelper.home(ChefUtils::Dist::Infra::USER_CONF_DIR) end def apply_config(config_content, config_file_path) |