summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Albertson <lance@osuosl.org>2021-04-07 13:15:23 -0700
committerLance Albertson <lance@osuosl.org>2021-04-09 16:12:31 -0700
commit7a9a11dad7c0468e42ab4675be4002445ee6984e (patch)
tree47a5647f9c19cf7c33f8e38d005dd8bff6a8c6f6
parent58340a5b13f9d57e02e3082febf75530402d889b (diff)
downloadchef-7a9a11dad7c0468e42ab4675be4002445ee6984e.tar.gz
Use dist constants in rubygems provider for is_omnibus? method
This resolves the following issue [1] which impacts community distributions when using the gem_package provider. Instead of using static names, use proper distribution constants which can be easily set by distributions. TODO: We should update chefdk with Workstation constants once those are created. [1] https://gitlab.com/cinc-project/distribution/client/-/issues/31 Signed-off-by: Lance Albertson <lance@osuosl.org>
-rw-r--r--lib/chef/provider/package/rubygems.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb
index 9ac1e7d31b..54d43e2772 100644
--- a/lib/chef/provider/package/rubygems.rb
+++ b/lib/chef/provider/package/rubygems.rb
@@ -423,11 +423,11 @@ class Chef
end
def is_omnibus?
- if %r{/(opscode|chef|chefdk)/embedded/bin}.match?(RbConfig::CONFIG["bindir"])
+ if %r{/(#{ChefUtils::Dist::Org::LEGACY_CONF_DIR}|#{ChefUtils::Dist::Infra::SHORT}|chefdk)/embedded/bin}.match?(RbConfig::CONFIG["bindir"])
logger.trace("#{new_resource} detected omnibus installation in #{RbConfig::CONFIG["bindir"]}")
# Omnibus installs to a static path because of linking on unix, find it.
true
- elsif RbConfig::CONFIG["bindir"].sub(/^\w:/, "") == "/opscode/chef/embedded/bin"
+ elsif RbConfig::CONFIG["bindir"].sub(/^\w:/, "") == "/#{ChefUtils::Dist::Org::LEGACY_CONF_DIR}/#{ChefUtils::Dist::Infra::SHORT}/embedded/bin"
logger.trace("#{new_resource} detected omnibus installation in #{RbConfig::CONFIG["bindir"]}")
# windows, with the drive letter removed
true