...
 
Commits (777)
#!/bin/bash
set -eu
docker ps || true
free -m || true
# We've now seen cases where origin/master on the build hosts can get
# out of date. This causes us to build components unnecessarily.
# Fetching it here hopefully will prevent this situation.
echo "Fetching origin/master"
git fetch origin master
# DEBUGGING FOR RELENG
# Fetch the git tags to see if that addresses the weird smart build behavior for Habitat
git fetch --tags --force
# Rebase onto current master to ensure this PR is closer to what happens when it's merged.
# Only do this if it's actually a branch (i.e. a PR or a manually created build), not a
# post-merge CI run of master.
if [[ "$BUILDKITE_BRANCH" != "master" ]]; then
git config user.email "[email protected]" # these are needed for the rebase attempt
git config user.name "Your Name"
master=$(git show-ref -s --abbrev origin/master)
pr_head=$(git show-ref -s --abbrev HEAD)
github="https://github.com/chef/chef/commit/"
if git rebase origin/master >/dev/null; then
buildkite-agent annotate --style success --context "rebase-pr-branch-${master}" \
"Rebased onto master ([${master}](${github}${master}))."
else
git rebase --abort
buildkite-agent annotate --style warning --context "rebase-pr-branch-${master}" \
"Couldn't rebase onto master ([${master}](${github}${master})), building PR HEAD ([${pr_head}](${github}${pr_head}))."
fi
fi
......@@ -2,7 +2,7 @@
---
# the name we use for this project when interacting with expeditor chatbot
project:
alias: chef-15
alias: chef-16
# The name of the product keys for this product (from mixlib-install)
product_key:
......@@ -60,6 +60,8 @@ github:
# for building.
release_branch:
- master:
version_constraint: 16*
- chef-15:
version_constraint: 15*
- chef-14:
version_constraint: 14*
......
......@@ -13,14 +13,14 @@ builder-to-testers-map:
debian-8-x86_64:
- debian-8-x86_64
- debian-9-x86_64
- debian-10-x86_64
el-6-i686:
- el-6-i686
el-6-s390x:
- el-6-s390x
el-6-x86_64:
- el-6-x86_64
el-7-aarch64:
- el-7-aarch64
- el-8-aarch64
el-7-ppc64:
- el-7-ppc64
el-7-ppc64le:
......@@ -42,17 +42,16 @@ builder-to-testers-map:
sles-12-x86_64:
- sles-12-x86_64
- sles-15-x86_64
solaris2-5.11-i386:
- solaris2-5.11-i386
solaris2-5.11-sparc:
- solaris2-5.11-sparc
# solaris2-5.11-i386:
# - solaris2-5.11-i386
# solaris2-5.11-sparc:
# - solaris2-5.11-sparc
ubuntu-16.04-x86_64:
- ubuntu-16.04-x86_64
- ubuntu-18.04-x86_64
windows-2012r2-i386:
- windows-2012r2-i386
windows-2012r2-x86_64:
- windows-2008r2-x86_64
- windows-2012-x86_64
- windows-2012r2-x86_64
- windows-2016-x86_64
......
......@@ -26,14 +26,11 @@ steps:
docker:
image: rubydistros/ubuntu-18.04
privileged: true
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- BUNDLE_GEMFILE=/workdir/Gemfile
- label: "Functional Specs Ubuntu :ruby: 2.6"
commands:
- /workdir/scripts/bk_tests/bk_container_prep.sh
- apt-get update -y
- apt-get install -y cron locales # needed for functional tests to pass
- cd /workdir; bundle install --jobs=3 --retry=3 --without omnibus_package docgen ruby_prof
- bundle exec rake spec:functional
......@@ -42,9 +39,6 @@ steps:
docker:
image: rubydistros/ubuntu-18.04
privileged: true
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- label: "Unit Specs Ubuntu :ruby: 2.6"
commands:
......@@ -56,9 +50,6 @@ steps:
executor:
docker:
image: rubydistros/ubuntu-18.04
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- label: "Integration Specs CentOS :ruby: 2.6"
commands:
......@@ -70,10 +61,6 @@ steps:
docker:
image: rubydistros/centos-7
privileged: true
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- BUNDLE_GEMFILE=/workdir/Gemfile
- label: "Functional Specs CentOS :ruby: 2.6"
commands:
......@@ -86,9 +73,6 @@ steps:
docker:
image: rubydistros/centos-7
privileged: true
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- label: "Unit Specs CentOS :ruby: 2.6"
commands:
......@@ -100,9 +84,6 @@ steps:
executor:
docker:
image: rubydistros/centos-7
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- label: "Integration Specs openSUSE :ruby: 2.6"
commands:
......@@ -114,10 +95,6 @@ steps:
docker:
image: rubydistros/opensuse-15
privileged: true
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- BUNDLE_GEMFILE=/workdir/Gemfile
- label: "Functional Specs openSUSE :ruby: 2.6"
commands:
......@@ -130,9 +107,6 @@ steps:
docker:
image: rubydistros/opensuse-15
privileged: true
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- label: "Unit Specs openSUSE :ruby: 2.6"
commands:
......@@ -144,9 +118,6 @@ steps:
executor:
docker:
image: rubydistros/opensuse-15
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- label: "Integration Specs Fedora :ruby: 2.6"
commands:
......@@ -158,10 +129,6 @@ steps:
docker:
image: rubydistros/fedora-latest
privileged: true
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- BUNDLE_GEMFILE=/workdir/Gemfile
- label: "Functional Specs Fedora :ruby: 2.6"
commands:
......@@ -188,9 +155,6 @@ steps:
executor:
docker:
image: rubydistros/fedora-latest
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- label: "Integration Specs Windows :ruby: 2.6"
commands:
......@@ -245,10 +209,10 @@ steps:
image: rubydistros/ubuntu-18.04
#########################################################################
# Tests Ruby 2.5
# Tests Ruby 2.7
#########################################################################
- label: "Integration Specs :ruby: 2.5"
- label: "Integration Specs :ruby: 2.7"
commands:
- /workdir/scripts/bk_tests/bk_container_prep.sh
- bundle install --jobs=3 --retry=3 --without omnibus_package docgen
......@@ -256,30 +220,23 @@ steps:
expeditor:
executor:
docker:
image: ruby:2.5-stretch
image: ruby:2.7-buster
privileged: true
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- INTEGRATION_SPECS_25=1
#
- label: "Functional Specs :ruby: 2.5"
- label: "Functional Specs :ruby: 2.7"
commands:
- /workdir/scripts/bk_tests/bk_container_prep.sh
- apt-get install -y cron locales # needed for functional tests to pass
- apt-get update -y
- apt-get install -y cron locales net-tools # needed for functional tests to pass
- bundle install --jobs=3 --retry=3 --without omnibus_package docgen
- bundle exec rake spec:functional
expeditor:
executor:
docker:
image: ruby:2.5-stretch
image: ruby:2.7-buster
privileged: true
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- FUNCTIONAL_SPECS_25=1
- label: "Unit Specs :ruby: 2.5"
- label: "Unit Specs :ruby: 2.7"
commands:
- /workdir/scripts/bk_tests/bk_container_prep.sh
- bundle install --jobs=3 --retry=3 --without omnibus_package docgen
......@@ -288,11 +245,7 @@ steps:
expeditor:
executor:
docker:
image: ruby:2.5-stretch
environment:
- FORCE_FFI_YAJL=ext
- CHEF_LICENSE=accept-no-persist
- UNIT_SPECS_25=1
image: ruby:2.7-buster
#########################################################################
# EXTERNAL GEM TESTING
......@@ -345,7 +298,20 @@ steps:
commands:
- /workdir/scripts/bk_tests/bk_container_prep.sh
- bundle install --jobs=3 --retry=3 --without omnibus_package docgen
- bundle exec tasks/bin/run_external_test chef/knife-windows master rake unit_spec
- bundle exec tasks/bin/run_external_test chef/knife-windows master rake spec
expeditor:
executor:
docker:
image: rubydistros/ubuntu-18.04
- label: "Test berkshelf gem :ruby: 2.6"
commands:
- /workdir/scripts/bk_tests/bk_container_prep.sh
- apt-get update -y
- apt-get install -y graphviz
- gem install bundler -v 1.17.3 # necessary for berks Gemfile.lock for now
- bundle install --jobs=3 --retry=3 --without omnibus_package docgen
- bundle exec tasks/bin/run_external_test berkshelf/berkshelf master rake
expeditor:
executor:
docker:
......@@ -416,6 +382,21 @@ steps:
privileged: true
single-use: true
- label: "Kitchen Tests Ubuntu: 20.04"
commands:
- scripts/bk_tests/bk_linux_exec.sh
- cd kitchen-tests
- ~/.asdf/shims/bundle exec kitchen test end-to-end-ubuntu-2004
artifact_paths:
- $PWD/.kitchen/logs/kitchen.log
env:
KITCHEN_YAML: kitchen.yml
expeditor:
executor:
linux:
privileged: true
single-use: true
- label: "Kitchen Tests Debian: 8"
commands:
- scripts/bk_tests/bk_linux_exec.sh
......
......@@ -80,6 +80,10 @@ docs_site
# Rendered Templates
ext/win32-eventlog/chef-log.man
distro/powershell/chef/chef.psm1
# tool logs
ext/win32-eventlog/mkmf.log
# ignore byebug command history file.
.byebug_history
--color
-fd
......@@ -19,7 +19,7 @@ Lint/AssignmentInCondition:
Enabled: false
Lint/AmbiguousBlockAssociation:
Enabled: false
Lint/UnneededSplatExpansion:
Lint/RedundantSplatExpansion:
Enabled: false
Lint/ShadowingOuterLocalVariable:
Enabled: false
......
This diff is collapsed.
......@@ -33,9 +33,9 @@ Code review takes place in GitHub pull requests. See [this article](https://help
Once you open a pull request, project maintainers will review your code and respond to your pull request with any feedback they might have. The process at this point is as follows:
1. Two thumbs-up (:+1:) are required from project maintainers. See the master maintainers document for Chef projects at <https://github.com/chef/chef-oss-practices/blob/master/projects/chef-infra.md>.
1. Two or more members of the owners, approvers, or reviewers groups must approve your PR. See the [Chef Infra OSS Project](https://github.com/chef/chef-oss-practices/blob/master/projects/chef-infra.md) for a list of all members.
2. Your change will be merged into the project's `master` branch
3. Our Expeditor bot will automatically update the project's changelog with your contribution. For projects such as Chef and Chef-DK the version will be automatically incremented and a build kicked off to the project's `current` channel.
3. Our Expeditor bot will automatically increment the version and update the project's changelog with your contribution. For projects that ship as a package, Expeditor will kick off a build which will publish the package to the project's `current` channel.
If you would like to learn about when your code will be available in a release of Chef, read more about [Chef Release Cycles](#release-cycles).
......@@ -90,7 +90,7 @@ The DCO requires a sign-off message in the following format appear on each commi
Signed-off-by: Julia Child <[email protected]>
```
The DCO text can either be manually added to your commit body, or you can add either **-s** or **--signoff** to your usual git commit commands. If you forget to add the sign-off you can also amend a previous commit with the sign-off by running **git commit --amend -s**. If you've pushed your changes to GitHub already you'll need to force push your branch after this with **git push -f**.
The DCO text can either be manually added to your commit body, or you can add either **-s** or **--signoff** to your usual git commit commands. If you are using the GitHub UI to make a change you can add the sign-off message directly to the commit message when creating the pull request. If you forget to add the sign-off you can also amend a previous commit with the sign-off by running **git commit --amend -s**. If you've pushed your changes to GitHub already you'll need to force push your branch after this with **git push -f**.
### Chef Obvious Fix Policy
......
......@@ -7,7 +7,6 @@ source "https://rubygems.org"
# of bundler versions prior to 1.12.0 (https://github.com/bundler/bundler/commit/193a14fe5e0d56294c7b370a0e59f93b2c216eed)
gem "chef", path: "."
# necessary until we release ohai 15
gem "ohai", git: "https://github.com/chef/ohai.git", branch: "master"
gem "chef-utils", path: File.expand_path("../chef-utils", __FILE__) if File.exist?(File.expand_path("../chef-utils", __FILE__))
......@@ -21,7 +20,7 @@ else
gem "chef-bin" # rubocop:disable Bundler/DuplicatedGem
end
gem "cheffish", "~> 14"
gem "cheffish", ">= 14"
group(:omnibus_package) do
gem "appbundler"
......@@ -46,7 +45,8 @@ end
# Everything except AIX
group(:ruby_prof) do
gem "ruby-prof"
# ruby-prof 1.3.0 does not compile on our centos6 builders/kitchen testers
gem "ruby-prof", "< 1.3.0"
end
# Everything except AIX and Windows
......@@ -58,7 +58,7 @@ group(:development, :test) do
# we pin rake as a copy of rake is installed from the ruby source
# if you bump the ruby version you should confirm we don't end up with
# two rake gems installed again
gem "rake", "<= 12.3.2"
gem "rake", "<= 13.0.1"
gem "rspec-core", "~> 3.5"
gem "rspec-mocks", "~> 3.5"
......
This diff is collapsed.
......@@ -22,7 +22,7 @@ For Chef Infra usage, please refer to our [Learn Chef Rally](https://learn.chef.
Other useful resources for Chef Infra users:
- Documentation: <https://docs.chef.io>
- Documentation: <https://docs.chef.io/>
- Source: <https://github.com/chef/chef/tree/master>
- Tickets/Issues: <https://github.com/chef/chef/issues>
- Slack: [Chef Community Slack](https://community-slack.chef.io/)
......@@ -32,7 +32,7 @@ Other useful resources for Chef Infra users:
Issues can be reported by using [GitHub Issues](https://github.com/chef/chef/issues).
Note that this repository is primarily for reporting issues in the chef-client itself. For reporting issues against other Chef projects, please look up the appropriate repository. If you're unsure where to submit an issue, please ask in the #chef-dev channel in [Chef Community Slack](https://community-slack.chef.io/).
Note that this repository is primarily for reporting issues in the chef-client itself. For reporting issues against other Chef projects, please look up the appropriate repository. If you're unsure where to submit an issue, please ask in the #chef-dev channel in [Chef Community Slack](https://community-slack.chef.io/).
## How We Build & Release Chef
......
This diff is collapsed.
......@@ -22,6 +22,7 @@ begin
require_relative "tasks/dependencies"
require_relative "tasks/announce"
require_relative "tasks/docs"
require_relative "lib/chef/dist"
rescue LoadError => e
puts "Skipping missing rake dep: #{e}"
end
......@@ -35,6 +36,14 @@ task :super_install do
Dir.chdir(path)
sh("rake install")
end
# Templating the powershell extensions so we can inject distro constants
template_file = ::File.join(::File.dirname(__FILE__), "distro", "templates", "powershell", "chef", "chef.psm1.erb")
psm1_path = ::File.join(::File.dirname(__FILE__), "distro", "powershell", "chef")
FileUtils.mkdir_p psm1_path
template = ERB.new(IO.read(template_file))
chef_psm1 = template.result
File.open(::File.join(psm1_path, "chef.psm1"), "w") { |f| f.write(chef_psm1) }
end
task install: :super_install
......
15.6.19
\ No newline at end of file
16.0.156
\ No newline at end of file
......@@ -21,7 +21,7 @@
module ChefBin
CHEFBIN_ROOT = File.expand_path("../..", __FILE__)
VERSION = "15.6.19".freeze
VERSION = "16.0.156".freeze
end
#
......
......@@ -4,7 +4,7 @@
# Author:: AJ Christensen (<[email protected]>)
# Author:: Mark Mzyk (<[email protected]>)
# Author:: Kyle Goodwin (<[email protected]>)
# Copyright:: Copyright 2008-2019, Chef Software Inc.
# Copyright:: Copyright 2008-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -75,20 +75,20 @@ module ChefConfig
end
# On *nix, /etc/chef
def self.etc_chef_dir
path = ChefUtils.windows? ? c_chef_dir : PathHelper.join("/etc", ChefConfig::Dist::DIR_SUFFIX)
def self.etc_chef_dir(is_windows = ChefUtils.windows?)
path = is_windows ? c_chef_dir : PathHelper.join("/etc", ChefConfig::Dist::DIR_SUFFIX)
PathHelper.cleanpath(path)
end
# On *nix, /var/chef
def self.var_chef_dir
path = ChefUtils.windows? ? c_chef_dir : PathHelper.join("/var", ChefConfig::Dist::DIR_SUFFIX)
def self.var_chef_dir(is_windows = ChefUtils.windows?)
path = is_windows ? c_chef_dir : PathHelper.join("/var", ChefConfig::Dist::DIR_SUFFIX)
PathHelper.cleanpath(path)
end
# On *nix, the root of /var/, used to test if we can create and write in /var/chef
def self.var_root_dir
path = ChefUtils.windows? ? c_chef_dir : "/var"
def self.var_root_dir(is_windows = ChefUtils.windows?)
path = is_windows ? c_chef_dir : "/var"
PathHelper.cleanpath(path)
end
......@@ -99,6 +99,12 @@ module ChefConfig
PathHelper.cleanpath(path)
end
def self.c_opscode_dir
drive = windows_installation_drive || "C:"
path = PathHelper.join(drive, ChefConfig::Dist::LEGACY_CONF_DIR, ChefConfig::Dist::DIR_SUFFIX)
PathHelper.cleanpath(path)
end
# the drive where Chef is installed on a windows host. This is determined
# either by the drive containing the current file or by the SYSTEMDRIVE ENV
# variable
......@@ -158,7 +164,7 @@ module ChefConfig
if config_file
PathHelper.dirname(PathHelper.canonical_path(config_file, false))
else
PathHelper.join(PathHelper.cleanpath(user_home), ".chef", "")
PathHelper.join(PathHelper.cleanpath(user_home), ChefConfig::Dist::USER_CONF_DIR, "")
end
end
......@@ -237,7 +243,7 @@ module ChefConfig
end
path = new_path
end
ChefConfig.logger.info("Auto-discovered chef repository at #{path}")
ChefConfig.logger.info("Auto-discovered #{ChefConfig::Dist::SHORT} repository at #{path}")
path
end
......@@ -272,15 +278,8 @@ module ChefConfig
# Location of cookbooks on disk. String or array of strings.
# Defaults to <chef_repo_path>/cookbooks. If chef_repo_path
# is not specified, this is set to [/var/chef/cookbooks, /var/chef/site-cookbooks]).
default(:cookbook_path) do
if configuration[:chef_repo_path]
derive_path_from_chef_repo_path("cookbooks")
else
Array(derive_path_from_chef_repo_path("cookbooks")).flatten +
Array(derive_path_from_chef_repo_path("site-cookbooks")).flatten
end
end
# is not specified, this is set to /var/chef/cookbooks.
default(:cookbook_path) { derive_path_from_chef_repo_path("cookbooks") }
# Location of data bags on disk. String or array of strings.
# Defaults to <chef_repo_path>/data_bags.
......@@ -339,7 +338,7 @@ module ChefConfig
# Otherwise, we'll create .chef under the user's home directory and use that as
# the cache path.
unless path_accessible?(primary_cache_path) || path_accessible?(primary_cache_root)
secondary_cache_path = PathHelper.join(user_home, ".chef")
secondary_cache_path = PathHelper.join(user_home, ChefConfig::Dist::USER_CONF_DIR)
secondary_cache_path = target_mode? ? "#{secondary_cache_path}/#{target_mode.host}" : secondary_cache_path
ChefConfig.logger.trace("Unable to access cache at #{primary_cache_path}. Switching cache to #{secondary_cache_path}")
secondary_cache_path
......@@ -370,7 +369,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, "chef-client-running.pid") }
default(:lockfile) { PathHelper.join(file_cache_path, "#{ChefConfig::Dist::CLIENT}-running.pid") }
## Daemonization Settings ##
# What user should Chef run as?
......@@ -401,6 +400,9 @@ module ChefConfig
# Using `force_logger` causes chef to default to logger output when STDOUT is a tty
default :force_logger, false
# When set to true always print the stacktrace even if we haven't done -l debug
default :always_dump_stacktrace, false
# Using 'stream_execute_output' will have Chef always stream the execute output
default :stream_execute_output, false
......@@ -764,7 +766,7 @@ module ChefConfig
if chef_server_url.to_s =~ %r{/organizations/(.*)$}
"#{$1}-validator"
else
"chef-validator"
"#{ChefConfig::Dist::SHORT}-validator"
end
end
......@@ -832,13 +834,13 @@ module ChefConfig
# Whether the resource count should be updated for log resource
# on running chef-client
default :count_log_resource_updates, true
default :count_log_resource_updates, false
# The selected profile when using credentials.
default :profile, nil
default :chef_guid_path do
PathHelper.join(config_dir, "chef_guid")
PathHelper.join(config_dir, "#{ChefConfig::Dist::SHORT}_guid")
end
default :chef_guid, nil
......@@ -1065,7 +1067,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, "chef_solo"
default :organization, "#{ChefConfig::Dist::SHORT}_solo"
end
configurable(:http_proxy)
......
module ChefConfig
class Dist
# The chef executable name. Also used in directory names.
# The chef executable name.
EXEC = "chef".freeze
# The client's alias (chef-client)
CLIENT = "chef-client".freeze
# A short name for the product
SHORT = "chef".freeze
# The suffix for Chef's /etc/chef, /var/chef and C:\\Chef directories
# "cinc" => /etc/cinc, /var/cinc, C:\\cinc
DIR_SUFFIX = "chef".freeze
# The user's configuration directory
USER_CONF_DIR = ".chef".freeze
# The legacy conf folder: C:/opscode/chef. Specifically the "opscode" part
# DIR_SUFFIX is appended to it in code where relevant
LEGACY_CONF_DIR = "opscode".freeze
end
end
......@@ -36,7 +36,7 @@ module ChefConfig
# normally set via a command-line option.
# @return [String]
def credentials_profile(profile = nil)
context_file = PathHelper.home(".chef", "context").freeze
context_file = PathHelper.home(ChefConfig::Dist::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(".chef", "credentials").freeze
PathHelper.home(ChefConfig::Dist::USER_CONF_DIR, "credentials").freeze
end
# Load and parse the credentials file.
......
#
# Author:: Bryan McLellan <[email protected]>
# Copyright:: Copyright 2014-2019, Chef Software Inc.
# Copyright:: Copyright 2014-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -265,15 +265,15 @@ module ChefConfig
end
end
# Determine if the given path is protected by OS X System Integrity Protection.
# Determine if the given path is protected by macOS System Integrity Protection.
def self.is_sip_path?(path, node)
if node["platform"] == "mac_os_x" && Gem::Version.new(node["platform_version"]) >= Gem::Version.new("10.11")
if ChefUtils.macos?
# @todo: parse rootless.conf for this?
sip_paths = [
"/System", "/bin", "/sbin", "/usr"
]
sip_paths.each do |sip_path|
ChefConfig.logger.info("This is a SIP path, checking if it in exceptions list.")
ChefConfig.logger.info("#{sip_path} is a SIP path, checking if it is in the exceptions list.")
return true if path.start_with?(sip_path)
end
false
......@@ -293,7 +293,7 @@ module ChefConfig
sip_exceptions.each do |exception_path|
return true if path.start_with?(exception_path)
end
ChefConfig.logger.error("Cannot write to a SIP Path on OS X 10.11+")
ChefConfig.logger.error("Cannot write to a SIP path #{path} on macOS!")
false
end
......
......@@ -15,5 +15,5 @@
module ChefConfig
CHEFCONFIG_ROOT = File.expand_path("../..", __FILE__)
VERSION = "15.6.19".freeze
VERSION = "16.0.156".freeze
end
......@@ -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] + [".chef"])
candidate_directory = File.join(full_path[0..i] + [ChefConfig::Dist::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(".chef") do |dot_chef_dir|
PathHelper.home(ChefConfig::Dist::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
......@@ -186,7 +186,7 @@ module ChefConfig
end
def home_chef_dir
@home_chef_dir ||= PathHelper.home(".chef")
@home_chef_dir ||= PathHelper.home(ChefConfig::Dist::USER_CONF_DIR)
end
def apply_config(config_content, config_file_path)
......
......@@ -11,7 +11,7 @@ gemspec.add_dependency "win32-eventlog", "0.6.3"
gemspec.add_dependency "win32-mmap", "~> 0.4.1"
gemspec.add_dependency "win32-mutex", "~> 0.4.2"
gemspec.add_dependency "win32-process", "~> 0.8.2"
gemspec.add_dependency "win32-service", ">= 2.1.2", "< 3.0"
gemspec.add_dependency "win32-service", ">= 2.1.5", "< 3.0"
gemspec.add_dependency "wmi-lite", "~> 1.0"
gemspec.add_dependency "win32-taskscheduler", "~> 2.0"
gemspec.add_dependency "iso8601", "~> 0.12.1"
......
......@@ -120,6 +120,38 @@ Architecture Helpers allow you to determine the processor architecture of your n
* `s390x?`
* `s390?`
### Cloud Helpers
* `cloud?` - if the node is running in any cloud, including internal ones
* `ec2?` - if the node is running in ec2
* `gce?` - if the node is running in gce
* `rackspace?` - if the node is running in rackspace
* `eucalyptus?` - if the node is running under eucalyptus
* `linode?` - if the node is running in linode
* `openstack?` - if the node is running under openstack
* `azure?` - if the node is running in azure
* `digital_ocean?` - if the node is running in digital ocean
* `softlayer?` - if the node is running in softlayer
### Virtualization Helpers
* `kvm?` - if the node is a kvm guest
* `kvm_host?` - if the node is a kvm host
* `lxc?` - if the node is an lxc guest
* `lxc_host?` - if the node is an lxc host
* `parallels?`- if the node is a parallels guest
* `parallels_host?`- if the node is a parallels host
* `vbox?` - if the node is a virtualbox guest
* `vbox_host?` - if the node is a virtualbox host
* `vmware?` - if the node is a vmware guest
* `vmware_host?` - if the node is a vmware host
* `openvz?` - if the node is an openvz guest
* `openvz_host?` - if the node is an openvz host
* `guest?` - if the node is detected as any kind of guest
* `hypervisor?` - if the node is detected as being any kind of hypervisor
* `physical?` - the node is not running as a guest (may be a hypervisor or may be bare-metal)
* `vagrant?` - attempts to identify the node as a vagrant guest (this check may be error prone)
### Train Helpers
**EXPERIMENTAL**: APIs may have breaking changes any time without warning
......@@ -133,6 +165,7 @@ Architecture Helpers allow you to determine the processor architecture of your n
* `systemd?` - if the init system is systemd
* `kitchen?` - if ENV['TEST_KITCHEN'] is set
* `ci?` - if ENV['CI'] is set
* `include_recipe?(recipe_name)` - if the `recipe_name` is in the run list, the expanded run list, or has been `include_recipe`'d.
### Service Helpers
......@@ -153,16 +186,34 @@ Architecture Helpers allow you to determine the processor architecture of your n
* `sanitized_path`
## Documentation for Cookbook library authors
To use the helpers in a class or module in a cookbook library file you can include the ChefUtils DSL:
```ruby
module MyHelper
include ChefUtils # or any individual module with DSL methods in it
def do_something
puts "RHEL" if rhel?
end
extend self
end
```
Now you can include MyHelper in another class/module, or you can call MyHelper.do_something directly.
## Documentation for Software Developers
The design of the DSL helper libraries in this gem are designed around the Chef Infra Client use cases. Most of the helpers are
accessible through the Chef DSL directly via the `ChefUtils::DSL` module. They are also available via class method calls on
accessible through the Chef DSL directly via the `ChefUtils` module. They are also available via class method calls on
the ChefUtils module directly (e.g. `ChefUtils.debian?`). For that to be possible there is Chef Infra Client specific wiring in
the `ChefUtils::Internal` class allowing the helpers to access the `Chef.run_context` global values. This allows them to be
used from library helpers in cookbooks inside Chef Infra Client.
For external use in other gems, this automatic wiring will not work correctly, and so it will not generally be possible to
call helpers off of the `ChefUtils` class (somee exceptions that do not require a node-like object or a train connection will
call helpers off of the `ChefUtils` class (some exceptions that do not require a node-like object or a train connection will
may still work). For use in other gems you should create your own module and mixin the helper class. If you have a node
method in your class/module then that method will be used.
......@@ -170,7 +221,7 @@ You can wire up a module which implements the Chef DSL with your own wiring usin
```ruby
module MyDSL
include ChefUtils::DSL # or any individual module with DSL methods in it
include ChefUtils # or any individual module with DSL methods in it
private
......
#
# Copyright:: Copyright 2015-2019, Chef Software Inc.
# Copyright:: Copyright 2015-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -16,26 +16,34 @@
#