chef 13.1.31 → 13.2.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +68 -134
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +1 -0
- data/acceptance/top-cookbooks/.kitchen.docker.yml +4 -0
- data/lib/chef/application/client.rb +27 -18
- data/lib/chef/deprecated.rb +10 -0
- data/lib/chef/dsl/declare_resource.rb +9 -1
- data/lib/chef/knife.rb +5 -1
- data/lib/chef/knife/cookbook_test.rb +1 -1
- data/lib/chef/policy_builder/policyfile.rb +27 -1
- data/lib/chef/provider.rb +2 -2
- data/lib/chef/provider/group/aix.rb +1 -1
- data/lib/chef/provider/group/groupadd.rb +1 -1
- data/lib/chef/provider/package/chocolatey.rb +1 -1
- data/lib/chef/provider/user/pw.rb +1 -1
- data/lib/chef/provider/user/windows.rb +1 -1
- data/lib/chef/resource/breakpoint.rb +1 -1
- data/lib/chef/version.rb +3 -1
- data/lib/chef/version_string.rb +143 -0
- data/spec/functional/mixin/powershell_out_spec.rb +20 -4
- data/spec/functional/resource/group_spec.rb +19 -13
- data/spec/functional/resource/windows_task_spec.rb +2 -9
- data/spec/integration/knife/common_options_spec.rb +29 -11
- data/spec/integration/knife/cookbook_bulk_delete_spec.rb +2 -2
- data/spec/integration/knife/cookbook_show_spec.rb +2 -2
- data/spec/integration/knife/environment_compare_spec.rb +2 -2
- data/spec/integration/knife/environment_show_spec.rb +2 -2
- data/spec/integration/knife/role_show_spec.rb +2 -2
- data/spec/integration/recipes/accumulator_spec.rb +6 -6
- data/spec/integration/recipes/resource_action_spec.rb +18 -7
- data/spec/integration/recipes/resource_load_spec.rb +5 -21
- data/spec/spec_helper.rb +2 -0
- data/spec/support/platform_helpers.rb +5 -0
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +1 -1
- data/spec/unit/application/client_spec.rb +2 -0
- data/spec/unit/knife_spec.rb +22 -0
- data/spec/unit/policy_builder/policyfile_spec.rb +50 -0
- data/spec/unit/provider/group/groupadd_spec.rb +1 -1
- data/spec/unit/provider/user/pw_spec.rb +1 -1
- data/spec/unit/version_string_spec.rb +79 -0
- data/tasks/dependencies.rb +1 -42
- metadata +6 -79
- data/acceptance/.bundle/config +0 -2
- data/acceptance/bin/aws.rb +0 -17
- data/acceptance/bin/berks +0 -17
- data/acceptance/bin/bundler +0 -17
- data/acceptance/bin/chef-acceptance +0 -17
- data/acceptance/bin/coderay +0 -17
- data/acceptance/bin/erubis +0 -17
- data/acceptance/bin/htmldiff +0 -17
- data/acceptance/bin/httpclient +0 -17
- data/acceptance/bin/inspec +0 -17
- data/acceptance/bin/kitchen +0 -17
- data/acceptance/bin/ldiff +0 -17
- data/acceptance/bin/nokogiri +0 -17
- data/acceptance/bin/pry +0 -17
- data/acceptance/bin/rake +0 -17
- data/acceptance/bin/rspec +0 -17
- data/acceptance/bin/rwinrm +0 -17
- data/acceptance/bin/rwinrmcp +0 -17
- data/acceptance/bin/safe_yaml +0 -17
- data/acceptance/bin/thor +0 -17
- data/acceptance/fips/.kitchen/fips-unit-functional-centos-6.yml +0 -7
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/id +0 -1
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/Vagrantfile +0 -11
- data/acceptance/fips/.kitchen/logs/fips-integration-centos-6.log +0 -0
- data/acceptance/fips/.kitchen/logs/fips-integration-windows-2012r2.log +0 -0
- data/acceptance/fips/.kitchen/logs/fips-unit-functional-centos-6.log +0 -80
- data/acceptance/fips/.kitchen/logs/kitchen.log +0 -4
- data/tasks/bundle.rb +0 -73
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46f3d5cd0336f4203b7e6d5dc6b2ad968f02d0db
|
4
|
+
data.tar.gz: 133bae912a030f9d8443f34d37d05e27a5a9952b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfaf798e23a92d0ce78b6cab250f8ad7035a002f8ba8b7c0be9e44d355d608ca948be756d5f432af5f758e9929de123c235e89a09e19fcb0c4c9c11d1d94fc9b
|
7
|
+
data.tar.gz: '089f2e2c8ac56f720faeac7933bebc13e50522538e3f5feb706a58e110245259517ce41f43910f812b33193817abaebd3a7896ae2be1976fb9e849a4fb9b7ca1'
|
data/README.md
CHANGED
@@ -24,51 +24,55 @@ If you just want to use Chef, check out these resources:
|
|
24
24
|
- [Installer Downloads](https://downloads.chef.io/chef/): Install Chef as a complete package
|
25
25
|
- [chef/chef](https://hub.docker.com/r/chef/chef): Docker image for use with [kitchen-dokken](https://github.com/someara/kitchen-dokken)
|
26
26
|
|
27
|
+
## Reporting Issues
|
28
|
+
|
29
|
+
Issues can be reported by using [GitHub Issues](https://github.com/chef/chef/issues).
|
30
|
+
|
31
|
+
Full details on how to report issues can be found in the [CONTRIBUTING](https://github.com/chef/chef/blob/master/CONTRIBUTING.md#-chef-issue-tracking) doc.
|
32
|
+
|
33
|
+
Note that this repository is primarily for reporting chef-client issues.
|
34
|
+
For reporting issues against other Chef projects, please look up the appropriate repository
|
35
|
+
to report issues against in the Chef docs in the
|
36
|
+
[community contributions section](https://docs.chef.io/community_contributions.html#issues-and-bug-reports).
|
37
|
+
If you can't determine the appropriate place to report an issue, then please open it
|
38
|
+
against the repository you think best fits and it will be directed to the appropriate project.
|
39
|
+
|
27
40
|
## Installing From Git
|
28
41
|
|
29
|
-
**NOTE:**
|
30
|
-
|
31
|
-
|
32
|
-
to get a prebuilt package.
|
42
|
+
**NOTE:** As a Chef user, please download the omnibus package of [Chef](https://downloads.chef.io/chef) or [Chef-DK](https://downloads.chef.io/chef)
|
43
|
+
|
44
|
+
We do not recommend installing from gems, or building from source. The following instructions apply only to those doing software development on Chef.
|
33
45
|
|
34
46
|
### Prerequisites
|
35
47
|
|
36
|
-
Install
|
37
|
-
`emerge`, etc.):
|
48
|
+
Install:
|
38
49
|
|
39
50
|
* git
|
40
|
-
* C compiler, header files, etc.
|
41
|
-
|
42
|
-
* ruby 2.3.0 or later
|
51
|
+
* C compiler, header files, etc.
|
52
|
+
* ruby 2.3.3 or later
|
43
53
|
* rubygems
|
44
54
|
* bundler gem
|
45
55
|
|
56
|
+
We support too many platforms, and there are too many different ways to manage ruby installs, so
|
57
|
+
it is assumed the user understands how to accomplish this for their platform and needs (see previous
|
58
|
+
note about downloading the pre-built omnibus install if you do not understand how to accomplish this).
|
59
|
+
|
46
60
|
### Chef Installation
|
47
61
|
|
48
62
|
Then get the source and install it:
|
49
63
|
|
50
64
|
```bash
|
51
|
-
# Clone this repo
|
52
65
|
git clone https://github.com/chef/chef.git
|
53
|
-
|
54
|
-
# cd into the source tree
|
55
66
|
cd chef
|
56
|
-
|
57
|
-
# Install dependencies with bundler
|
58
67
|
bundle install
|
59
|
-
|
60
|
-
# Build a gem
|
61
68
|
bundle exec rake gem
|
62
|
-
|
63
|
-
# Install the gem you just built
|
64
|
-
gem install pkg/chef-VERSION.gem
|
69
|
+
bundle exec rake install
|
65
70
|
```
|
66
71
|
|
67
72
|
## Contributing/Development
|
68
73
|
|
69
|
-
|
70
|
-
|
71
|
-
[Chef Contributions document](https://docs.chef.io/community_contributions.html).
|
74
|
+
Please read our [Community Contributions Guidelines](https://docs.chef.io/community_contributions.html), and
|
75
|
+
ensure you are signing all your commits with DCO sign-off.
|
72
76
|
|
73
77
|
The general development process is:
|
74
78
|
|
@@ -82,59 +86,62 @@ RSpec for test driven development, so you'll need to get a development
|
|
82
86
|
environment running. Follow the above procedure ("Installing from Git") to get
|
83
87
|
your local copy of the source running.
|
84
88
|
|
85
|
-
## Reporting Issues
|
86
|
-
|
87
|
-
Issues can be reported by using [GitHub Issues](https://github.com/chef/chef/issues).
|
88
|
-
|
89
|
-
Full details on how to report issues can be found in the [CONTRIBUTING](https://github.com/chef/chef/blob/master/CONTRIBUTING.md#-chef-issue-tracking) doc.
|
90
|
-
|
91
|
-
Note that this repository is primarily for reporting chef-client issues.
|
92
|
-
For reporting issues against other Chef projects, please look up the appropriate repository
|
93
|
-
to report issues against in the Chef docs in the
|
94
|
-
[community contributions section](https://docs.chef.io/community_contributions.html#issues-and-bug-reports).
|
95
|
-
If you can't determine the appropriate place to report an issue, then please open it
|
96
|
-
against the repository you think best fits and it will be directed to the appropriate project.
|
97
|
-
|
98
89
|
## Testing
|
99
90
|
|
100
|
-
|
101
|
-
environment to run the specs--they are completely standalone.
|
91
|
+
This repository only uses rspec for testing.
|
102
92
|
|
103
93
|
```bash
|
104
|
-
#
|
105
|
-
bundle exec
|
94
|
+
# all tests
|
95
|
+
bundle exec rspec
|
106
96
|
|
107
|
-
#
|
97
|
+
# single test
|
108
98
|
bundle exec rspec spec/PATH/TO/FILE_spec.rb
|
109
99
|
|
110
|
-
#
|
100
|
+
# all tests under a subdir
|
111
101
|
bundle exec rspec spec/PATH/TO/DIR
|
112
102
|
```
|
113
103
|
|
114
|
-
When you submit a
|
115
|
-
tests in spec/functional/ and spec/unit/ respectively. These will be run on Ubuntu
|
116
|
-
through Travis CI, and on Windows through AppVeyor. The status of these runs will
|
117
|
-
be displayed with your pull request.
|
104
|
+
When you submit a PR rspec tests will run automatically on travis and appveyor.
|
118
105
|
|
119
106
|
## Building the Full Package
|
120
107
|
|
121
|
-
To build chef as a standalone package
|
108
|
+
To build chef as a standalone package, we use the [omnibus](omnibus/README.md) system.
|
109
|
+
|
110
|
+
To build:
|
111
|
+
|
112
|
+
```bash
|
113
|
+
git clone https://github.com/chef/chef.git
|
114
|
+
cd chef/omnibus
|
115
|
+
bundle install
|
116
|
+
bundle exec omnibus build chef
|
117
|
+
```
|
118
|
+
|
119
|
+
The prerequisites necessary to run omnibus itself are not documented here. The automation we use is
|
120
|
+
the [opscode-ci cookbook](https://github.com/chef-cookbooks/opscode-ci) cookbook, which serves as the most
|
121
|
+
current documentation.
|
122
122
|
|
123
123
|
## Updating Dependencies
|
124
124
|
|
125
125
|
If you want to change our constraints (change which packages and versions we accept in the chef), there are several places to do so:
|
126
126
|
|
127
|
-
*
|
128
|
-
*
|
129
|
-
*
|
127
|
+
* [Gemfile](Gemfile) and [Gemfile.lock](Gemfile.lock): All gem version constraints (update with `bundle update`)
|
128
|
+
* [omnibus_overrides.rb](omnibus_overrides_rb): Pinned versions of omnibus packages.
|
129
|
+
* [omnibus/Gemfile](omnibus/Gemfile) and [omnibus/Gemfile.lock](omnibus/Gemfile.lock): Gems for the omnibus build system itself.
|
130
|
+
|
131
|
+
In addition there are several places versions are pinned for CI tasks:
|
132
|
+
|
133
|
+
* [acceptance/Gemfile](acceptance/Gemfile) and [acceptance/Gemfile.lock](acceptance/Gemfile.lock): Acceptance tests (internal jenkins)
|
134
|
+
* [kitchen-tests/Gemfile](kitchen-tests/Gemfile) and [kitchen-tests/Gemfile.lock](kitchen-tests/Gemfile.lock): Gems for test-kitchen tests (travis)
|
135
|
+
* [kitchen-tests/Berksfile](kitchen-tests/Berksfile) and [kitchen-tests/Berksfile.lock](kitchen-tests/Berksfile.lock): Cookbooks for test-kitchen tests (travis)
|
130
136
|
|
131
|
-
|
132
|
-
|
133
|
-
* To update chef's gem dependencies *conservatively* (changing as little as possible), run `rake bundle:install`.
|
134
|
-
* To update specific gems only, run `rake bundle:update[gem1 gem2 ...]`
|
135
|
-
* **`bundle update` and `bundle install` will *not* work, on purpose:** the rake task handles both the windows and non-windows lockfiles and updates them in sync.
|
137
|
+
In order to update everything run `rake dependencies`. Note that the [Gemfile.lock](Gemfile.lock) pins windows platforms and to fully regenerate the lockfile
|
138
|
+
you must use the following commands or run `rake dependencies:update_gemfile_lock`:
|
136
139
|
|
137
|
-
|
140
|
+
```bash
|
141
|
+
bundle lock --update --add-platform ruby
|
142
|
+
bundle lock --update --add-platform x64-mingw32
|
143
|
+
bundle lock --update --add-platform x86-mingw32
|
144
|
+
```
|
138
145
|
|
139
146
|
# How Chef Builds and Versions
|
140
147
|
|
@@ -188,35 +195,23 @@ Sometimes, regressions split through the cracks. Since new functionality is alwa
|
|
188
195
|
|
189
196
|
Chef has two sorts of component: ruby components like `berkshelf` and `test-kitchen`, and binary components like `openssl` and even `ruby` itself.
|
190
197
|
|
191
|
-
In general, you can find all chef desired versions in the [Gemfile](Gemfile) and [
|
198
|
+
In general, you can find all chef desired versions in the [Gemfile](Gemfile) and [omnibus_overrides.rb](omnibus_overrides.rb) files. The [Gemfile.lock](Gemfile.lock) is the locked version of the Gemfile.
|
192
199
|
|
193
200
|
### Binary Components
|
194
201
|
|
195
|
-
The versions of binary components (as well as rubygems and bundler, which can't be versioned in a Gemfile) are stored in [
|
202
|
+
The versions of binary components (as well as rubygems and bundler, which can't be versioned in a Gemfile) are stored in [omnibus_overrides.rb](omnibus_overrides.rb).
|
196
203
|
|
197
204
|
These have software definitions either in [omnibus/config/software](omnibus/config/software) or, more often, in the [omnibus-software](https://github.com/chef/omnibus-software/tree/master/config/software) project.
|
198
205
|
|
199
206
|
### Rubygems Components
|
200
207
|
|
201
|
-
|
202
|
-
|
203
|
-
Our rubygems component versions are locked down with `Gemfile.lock`, and can be updated with `rake dependencies`.
|
204
|
-
|
205
|
-
There are three gems versioned outside the `Gemfile`: `rubygems`, `bundler` and `chef`. `rubygems` and `bundler` are in the `RUBYGEMS_AT_LATEST_VERSION` constant in [version_policy.rb](version-policy.rb) and locked in [omnibus_overrides](omnibus_overrides.rb). They are kept up to date by `rake dependencies`.
|
206
|
-
|
207
|
-
**Windows**: [Gemfile.lock](Gemfile.lock) is generated platform-agnostic, and then generated again for Windows. The one file has the solution for both Linux and Windows.
|
208
|
-
|
209
|
-
The tool we use to generate Windows-specific lockfiles on non-Windows machines is [tasks/bin/bundle-platform](bundle-platform), which takes the first argument and sets `Gem.platforms`, and then calls `bundle` with the remaining arguments.
|
208
|
+
Our rubygems component versions are locked down with `Gemfile.lock`, and can be updated with `bundle update` or `rake dependencies:update_gemfile_lock`.
|
210
209
|
|
211
210
|
### Build Tooling Versions
|
212
211
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
Second, the version of omnibus we use to build chef is governed by `omnibus/Gemfile`. When software definitions or the omnibus framework is updated, this is the file that drives whether we pick it up.
|
218
|
-
|
219
|
-
The omnibus tooling versions are locked down with `omnibus/Gemfile.lock`, and can be updated by running `rake dependencies`.
|
212
|
+
The external environment necessary to build omnibus (compilers, make, git, etc) is configured by the [opscode-ci cookbook](https://github.com/chef-cookbooks/opscode-ci) cookbook. In order to reliably create omnibus builds that cookbook should be used to install the prerequisites. It may be possible to install the latest version
|
213
|
+
of utilities on a suitably recent distribution and be able to build an omnibus package, but the necessary prerequisites will not be documented here. In most
|
214
|
+
cases a recent MacOS with Xcode and a few homebrew packages or a recent Ubuntu distribution with packages like `build-essentials` should suffice.
|
220
215
|
|
221
216
|
### Test Versions
|
222
217
|
|
@@ -224,67 +219,6 @@ chef is tested by the [chef-acceptance framework](https://github.com/chef/chef-a
|
|
224
219
|
|
225
220
|
The test tooling versions are locked down with `acceptance/Gemfile.lock`, which can be updated by running `rake dependencies`.
|
226
221
|
|
227
|
-
## The Build Process
|
228
|
-
|
229
|
-
The actual Chef build process is done with Omnibus, and has several general steps:
|
230
|
-
|
231
|
-
1. `bundle install` from `chef/Gemfile.lock`
|
232
|
-
2. Reinstall any gems that came from git or path using `rake install`
|
233
|
-
3. appbundle chef, chef, test-kitchen and berkshelf
|
234
|
-
4. Put miscellaneous powershell scripts and cleanup
|
235
|
-
|
236
|
-
### Kicking Off The Build
|
237
|
-
|
238
|
-
The build is kicked off in Jenkins by running this on the machine (which is already the correct OS and already has the correct dependencies, loaded by the `omnibus` cookbook):
|
239
|
-
|
240
|
-
```
|
241
|
-
load-omnibus-toolchain.bat
|
242
|
-
cd chef/omnibus
|
243
|
-
bundle install
|
244
|
-
bundle exec omnibus build chef
|
245
|
-
```
|
246
|
-
|
247
|
-
This causes the [chef project definition](omnibus/config/projects/chef.rb) to load, which runs the [chef-complete](omnibus/config/software/chef-complete.rb) software definition, the primary software definition driving the whole build process. The reason we embed it all in a software definition instead of the project is to take advantage of omnibus caching: omnibus will invalidate the entire project (and recompile ruby, openssl, and everything else) if you change anything at all in the project file. Not so with a software definition.
|
248
|
-
|
249
|
-
### Installing the Gems
|
250
|
-
|
251
|
-
The primary build definition that installs the many Chef rubygems is [`software/chef.rb`](omnibus/software/chef.rb). This has dependencies on any binary libraries, ruby, rubygems and bundler. It has a lot of steps, so it uses a [library](omnibus/files/chef/build-chef.rb) to help reuse code and make it manageable to look at.
|
252
|
-
|
253
|
-
What it does:
|
254
|
-
|
255
|
-
1. Depends on software defs for pre-cached gems (see "Gems and Caching" below).
|
256
|
-
2. Installs all gems from the bundle:
|
257
|
-
- Sets up a `.bundle/config` ([code](omnibus/files/chef/build-chef.rb#L17-L39)) with --retries=4, --jobs=1, --without=development,no_<platform>, and `build.config.nokogiri` to pass.
|
258
|
-
- Sets up a common environment, standardizing the compilers and flags we use, in [`env`](omnibus/files/chef-gem/build-chef-gem.rb#L32-L54).
|
259
|
-
- [Runs](omnibus/config/software/chef.rb#L68) `bundle install --verbose`
|
260
|
-
3. Reinstalls any gems that were installed via path:
|
261
|
-
- [Runs](omnibus/files/chef/build-chef.rb#L80) `bundle list --paths` to get the installed directories of all gems.
|
262
|
-
- For each gem not installed in the main gem dir, [runs](omnibus/files/chef/build-chef.rb#L89) `rake install` from the installed gem directory.
|
263
|
-
- [Deletes](omnibus/files/chef/build-chef.rb#L139-L143) the bundler git cache and path- and git-installed gems from the build.
|
264
|
-
4. [Creates](omnibus/files/chef/build-chef.rb#L102-L152) `/opt/chef/Gemfile` and `/opt/chef/Gemfile.lock` with the gems that were installed in the build.
|
265
|
-
|
266
|
-
#### Gems and Caching
|
267
|
-
|
268
|
-
Some gems take a super long time to install (particularly native-compiled ones such as nokogiri and dep-selector-libgecode) and do not change version very often. In order to avoid doing this work every time, we take advantage of omnibus caching by separating out these gems into their own software definitions. [chef-gem-dep-selector-libgecode](omnibus/config/software/chef-gem-dep-selector-libgecode.rb) for example.
|
269
|
-
|
270
|
-
Each of these gems uses the `config/files/chef-gem/build-chef-gem` library to define itself. The name of the software definition itself indicates the .
|
271
|
-
|
272
|
-
We only create software definitions for long-running gems. Everything else is just installed in the [chef](omnibus/config/software/chef.rb) software definition in a big `bundle install` catchall.
|
273
|
-
|
274
|
-
Most gems we just install in the single `chef` software definition.
|
275
|
-
|
276
|
-
The first thing
|
277
|
-
|
278
|
-
### Appbundling
|
279
|
-
|
280
|
-
After the gems are installed, we *appbundle* them in [chef-appbundle](omnibus/config/software/chef-appbundle.rb). This creates binstubs that use the bundle to pin the software .
|
281
|
-
|
282
|
-
During the process of appbundling, we update the gem's `Gemfile` to include the locks in the top level `/opt/chef/Gemfile.lock`, so we can guarantee they will never pick up things outside the build. We then run `bundle lock` to update the gem's `Gemfile.lock`, and `bundle check` to ensure all the gems are actually installed. The appbundler then uses these pins.
|
283
|
-
|
284
|
-
### Other Cleanup
|
285
|
-
|
286
|
-
Finally, chef does several more steps including installing powershell scripts and shortcuts, and removing extra documentation to keep the build slim.
|
287
|
-
|
288
222
|
# License
|
289
223
|
|
290
224
|
Chef - A configuration management system
|
data/Rakefile
CHANGED
@@ -34,6 +34,7 @@ require_relative "tasks/version"
|
|
34
34
|
ChefConfig::PackageTask.new(File.expand_path("..", __FILE__), "Chef", "chef") do |package|
|
35
35
|
package.component_paths = ["chef-config"]
|
36
36
|
package.generate_version_class = true
|
37
|
+
package.use_versionstring = true
|
37
38
|
end
|
38
39
|
|
39
40
|
task :pedant, :chef_zero_spec
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
13.
|
1
|
+
13.2.20
|
@@ -19,6 +19,7 @@ driver:
|
|
19
19
|
subnet_id: subnet-19ac017c
|
20
20
|
security_group_ids: ["sg-e401eb83", "sg-96274af3"]
|
21
21
|
instance_type: m3.large
|
22
|
+
retryable_tries: 120
|
22
23
|
# associate_public_ip: true # Don't enable public IP, as subnet specified is behind VPN
|
23
24
|
|
24
25
|
# busser installation relies on this
|
@@ -304,6 +304,7 @@ class Chef::Application::Client < Chef::Application
|
|
304
304
|
:boolean => false
|
305
305
|
|
306
306
|
IMMEDIATE_RUN_SIGNAL = "1".freeze
|
307
|
+
RECONFIGURE_SIGNAL = "H".freeze
|
307
308
|
|
308
309
|
attr_reader :chef_client_json
|
309
310
|
|
@@ -409,9 +410,15 @@ class Chef::Application::Client < Chef::Application
|
|
409
410
|
SELF_PIPE.replace IO.pipe
|
410
411
|
|
411
412
|
trap("USR1") do
|
412
|
-
Chef::Log.info("SIGUSR1 received,
|
413
|
+
Chef::Log.info("SIGUSR1 received, will run now or after the current run")
|
413
414
|
SELF_PIPE[1].putc(IMMEDIATE_RUN_SIGNAL) # wakeup master process from select
|
414
415
|
end
|
416
|
+
|
417
|
+
# Override the trap setup in the parent so we can avoid running reconfigure during a run
|
418
|
+
trap("HUP") do
|
419
|
+
Chef::Log.info("SIGHUP received, will reconfigure now or after the current run")
|
420
|
+
SELF_PIPE[1].putc(RECONFIGURE_SIGNAL) # wakeup master process from select
|
421
|
+
end
|
415
422
|
end
|
416
423
|
end
|
417
424
|
|
@@ -454,14 +461,14 @@ class Chef::Application::Client < Chef::Application
|
|
454
461
|
end
|
455
462
|
|
456
463
|
def sleep_then_run_chef_client(sleep_sec)
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
end
|
462
|
-
@signal = nil
|
464
|
+
Chef::Log.debug("Sleeping for #{sleep_sec} seconds")
|
465
|
+
|
466
|
+
# interval_sleep will return early if we received a signal (unless on windows)
|
467
|
+
interval_sleep(sleep_sec)
|
463
468
|
|
464
469
|
run_chef_client(Chef::Config[:specific_recipes])
|
470
|
+
|
471
|
+
reconfigure
|
465
472
|
rescue SystemExit => e
|
466
473
|
raise
|
467
474
|
rescue Exception => e
|
@@ -474,10 +481,6 @@ class Chef::Application::Client < Chef::Application
|
|
474
481
|
Chef::Application.fatal!("#{e.class}: #{e.message}", e)
|
475
482
|
end
|
476
483
|
|
477
|
-
def test_signal
|
478
|
-
@signal = interval_sleep(0)
|
479
|
-
end
|
480
|
-
|
481
484
|
def time_to_sleep
|
482
485
|
duration = 0
|
483
486
|
duration += rand(Chef::Config[:splay]) if Chef::Config[:splay]
|
@@ -485,20 +488,26 @@ class Chef::Application::Client < Chef::Application
|
|
485
488
|
duration
|
486
489
|
end
|
487
490
|
|
491
|
+
# sleep and handle queued signals
|
488
492
|
def interval_sleep(sec)
|
489
493
|
unless SELF_PIPE.empty?
|
490
|
-
|
494
|
+
# mimic sleep with a timeout on IO.select, listening for signals setup in #setup_signal_handlers
|
495
|
+
return unless IO.select([ SELF_PIPE[0] ], nil, nil, sec)
|
496
|
+
|
497
|
+
signal = SELF_PIPE[0].getc.chr
|
498
|
+
|
499
|
+
return if signal == IMMEDIATE_RUN_SIGNAL # be explicit about this behavior
|
500
|
+
|
501
|
+
# we need to sleep again after reconfigure to avoid stampeding when logrotate runs out of cron
|
502
|
+
if signal == RECONFIGURE_SIGNAL
|
503
|
+
reconfigure
|
504
|
+
interval_sleep(sleep)
|
505
|
+
end
|
491
506
|
else
|
492
|
-
# Windows
|
493
507
|
sleep(sec)
|
494
508
|
end
|
495
509
|
end
|
496
510
|
|
497
|
-
def client_sleep(sec)
|
498
|
-
return unless IO.select([ SELF_PIPE[0] ], nil, nil, sec)
|
499
|
-
@signal = SELF_PIPE[0].getc.chr
|
500
|
-
end
|
501
|
-
|
502
511
|
def unforked_interval_error_message
|
503
512
|
"Unforked chef-client interval runs are disabled in Chef 12." +
|
504
513
|
"\nConfiguration settings:" +
|
data/lib/chef/deprecated.rb
CHANGED
@@ -155,7 +155,15 @@ class Chef
|
|
155
155
|
def edit_resource(type, name, created_at: nil, run_context: self.run_context, &resource_attrs_block)
|
156
156
|
edit_resource!(type, name, created_at: created_at, run_context: run_context, &resource_attrs_block)
|
157
157
|
rescue Chef::Exceptions::ResourceNotFound
|
158
|
-
declare_resource(type, name, created_at: created_at, run_context: run_context
|
158
|
+
resource = declare_resource(type, name, created_at: created_at, run_context: run_context)
|
159
|
+
if resource_attrs_block
|
160
|
+
if defined?(new_resource)
|
161
|
+
resource.instance_exec(new_resource, &resource_attrs_block)
|
162
|
+
else
|
163
|
+
resource.instance_exec(&resource_attrs_block)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
resource
|
159
167
|
end
|
160
168
|
|
161
169
|
# Lookup a resource in the resource collection by name. If the resource is not
|