chef-dk 3.1.0 → 3.2.30

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  [![Build Status Master](https://travis-ci.org/chef/chef-dk.svg?branch=master)](https://travis-ci.org/chef/chef-dk)
4
4
  [![Build Status Master](https://ci.appveyor.com/api/projects/status/github/chef/chef-dk?branch=master&svg=true&passingText=master%20-%20Ok&pendingText=master%20-%20Pending&failingText=master%20-%20Failing)](https://ci.appveyor.com/project/Chef/chef-dk/branch/master)
5
5
  [![](https://img.shields.io/badge/Release%20Policy-Cadence%20Release-brightgreen.svg)](https://github.com/chef/chef-rfc/blob/master/rfc086-chef-oss-project-policies.md#cadence-release)
6
+ [![Docker Stars](https://img.shields.io/docker/stars/chef/chefdk.svg?maxAge=2592000)](https://hub.docker.com/r/chef/chefdk)
7
+ [![Docker Pulls](https://img.shields.io/docker/pulls/chef/chefdk.svg?maxAge=2592000)](https://hub.docker.com/r/chef/chefdk)
6
8
 
7
9
  Chef Development Kit (ChefDK) brings Chef and the development tools developed by the Chef Community together and acts as the consistent interface to this awesomeness. This awesomeness is composed of:
8
10
 
@@ -12,18 +12,18 @@ GEM
12
12
  addressable (2.5.2)
13
13
  public_suffix (>= 2.0.2, < 4.0)
14
14
  artifactory (2.8.2)
15
- aws-sdk (2.11.8)
16
- aws-sdk-resources (= 2.11.8)
17
- aws-sdk-core (2.11.8)
15
+ aws-sdk (2.11.120)
16
+ aws-sdk-resources (= 2.11.120)
17
+ aws-sdk-core (2.11.120)
18
18
  aws-sigv4 (~> 1.0)
19
19
  jmespath (~> 1.0)
20
- aws-sdk-resources (2.11.8)
21
- aws-sdk-core (= 2.11.8)
22
- aws-sigv4 (1.0.2)
23
- berkshelf (6.3.1)
20
+ aws-sdk-resources (2.11.120)
21
+ aws-sdk-core (= 2.11.120)
22
+ aws-sigv4 (1.0.3)
23
+ berkshelf (6.3.4)
24
24
  buff-config (~> 2.0)
25
25
  buff-extensions (~> 2.0)
26
- chef (>= 12.7.2)
26
+ chef (>= 12.7.2, < 14.0)
27
27
  cleanroom (~> 1.0)
28
28
  concurrent-ruby (~> 1.0)
29
29
  faraday (~> 0.9)
@@ -91,14 +91,14 @@ GEM
91
91
  coderay (1.1.2)
92
92
  concurrent-ruby (1.0.5)
93
93
  diff-lcs (1.3)
94
- docker-api (1.34.1)
94
+ docker-api (1.34.2)
95
95
  excon (>= 0.47.0)
96
96
  multi_json
97
97
  erubis (2.7.0)
98
- excon (0.60.0)
99
- faraday (0.14.0)
98
+ excon (0.62.0)
99
+ faraday (0.15.2)
100
100
  multipart-post (>= 1.2, < 3)
101
- ffi (1.9.23)
101
+ ffi (1.9.25)
102
102
  ffi-yajl (2.3.1)
103
103
  libyajl2 (~> 1.2)
104
104
  fuzzyurl (0.8.0)
@@ -106,13 +106,13 @@ GEM
106
106
  ffi (>= 1.0.1)
107
107
  gyoku (1.3.1)
108
108
  builder (>= 2.1.2)
109
- hashie (3.5.7)
109
+ hashie (3.6.0)
110
110
  highline (1.7.10)
111
- hitimes (1.2.6)
111
+ hitimes (1.3.0)
112
112
  htmlentities (4.3.4)
113
113
  httpclient (2.8.3)
114
114
  iniparse (1.4.4)
115
- inspec (1.51.21)
115
+ inspec (1.51.25)
116
116
  addressable (~> 2.4)
117
117
  faraday (>= 0.9.0)
118
118
  hashie (~> 3.4)
@@ -132,9 +132,9 @@ GEM
132
132
  tomlrb (~> 1.2)
133
133
  train (~> 0.32)
134
134
  ipaddress (0.8.3)
135
- jmespath (1.3.1)
135
+ jmespath (1.4.0)
136
136
  json (2.1.0)
137
- kitchen-ec2 (2.2.1)
137
+ kitchen-ec2 (2.2.2)
138
138
  aws-sdk (~> 2)
139
139
  excon
140
140
  multi_json
@@ -144,7 +144,7 @@ GEM
144
144
  hashie (~> 3.4)
145
145
  inspec (>= 0.34.0, < 3.0.0)
146
146
  test-kitchen (~> 1.6)
147
- kitchen-vagrant (1.3.1)
147
+ kitchen-vagrant (1.3.3)
148
148
  test-kitchen (~> 1.4)
149
149
  libyajl2 (1.2.0)
150
150
  little-plugger (1.1.4)
@@ -153,19 +153,20 @@ GEM
153
153
  multi_json (~> 1.10)
154
154
  method_source (0.9.0)
155
155
  minitar (0.6.1)
156
- mixlib-archive (0.4.1)
156
+ mixlib-archive (0.4.16)
157
157
  mixlib-log
158
158
  mixlib-authentication (1.4.2)
159
159
  mixlib-cli (1.7.0)
160
- mixlib-config (2.2.5)
160
+ mixlib-config (2.2.13)
161
+ tomlrb
161
162
  mixlib-install (1.2.3)
162
163
  artifactory
163
164
  mixlib-shellout
164
165
  mixlib-versioning
165
166
  mixlib-log (1.7.1)
166
- mixlib-shellout (2.3.2)
167
+ mixlib-shellout (2.4.0)
167
168
  mixlib-versioning (1.2.2)
168
- molinillo (0.6.4)
169
+ molinillo (0.6.6)
169
170
  multi_json (1.13.1)
170
171
  multipart-post (2.0.0)
171
172
  net-scp (1.2.1)
@@ -178,10 +179,10 @@ GEM
178
179
  net-ssh-multi (1.2.1)
179
180
  net-ssh (>= 2.6.5)
180
181
  net-ssh-gateway (>= 1.2.0)
181
- net-telnet (0.1.1)
182
- nio4r (2.2.0)
182
+ net-telnet (0.2.0)
183
+ nio4r (2.3.1)
183
184
  nori (2.6.0)
184
- octokit (4.8.0)
185
+ octokit (4.10.0)
185
186
  sawyer (~> 0.8.0, >= 0.5.3)
186
187
  ohai (8.26.1)
187
188
  chef-config (>= 12.5.0.alpha.1, < 14)
@@ -202,8 +203,8 @@ GEM
202
203
  pry (0.11.3)
203
204
  coderay (~> 1.1.0)
204
205
  method_source (~> 0.9.0)
205
- public_suffix (3.0.2)
206
- rack (1.6.9)
206
+ public_suffix (3.0.3)
207
+ rack (1.6.10)
207
208
  rainbow (2.1.0)
208
209
  retryable (2.0.4)
209
210
  ridley (5.1.1)
@@ -259,9 +260,9 @@ GEM
259
260
  solve (4.0.0)
260
261
  molinillo (~> 0.6)
261
262
  semverse (>= 1.1, < 3.0)
262
- specinfra (2.73.2)
263
+ specinfra (2.76.1)
263
264
  net-scp
264
- net-ssh (>= 2.7, < 5.0)
265
+ net-ssh (>= 2.7)
265
266
  net-telnet
266
267
  sfl
267
268
  sslshake (1.2.0)
@@ -278,7 +279,7 @@ GEM
278
279
  thor (0.19.1)
279
280
  timers (4.0.4)
280
281
  hitimes
281
- tomlrb (1.2.6)
282
+ tomlrb (1.2.7)
282
283
  train (0.32.0)
283
284
  docker-api (~> 1.26)
284
285
  json (>= 1.8, < 3.0)
@@ -305,7 +306,7 @@ GEM
305
306
  winrm-elevated (1.1.0)
306
307
  winrm (~> 2.0)
307
308
  winrm-fs (~> 1.0)
308
- winrm-fs (1.2.0)
309
+ winrm-fs (1.2.1)
309
310
  erubis (~> 2.7)
310
311
  logging (>= 1.6.1, < 3.0)
311
312
  rubyzip (~> 1.1)
@@ -331,4 +332,4 @@ DEPENDENCIES
331
332
  winrm-fs
332
333
 
333
334
  BUNDLED WITH
334
- 1.16.1
335
+ 1.16.4
@@ -26,6 +26,7 @@ Gem::Specification.new do |gem|
26
26
  gem.email = [ "dan@chef.io", "lamont@chef.io", "serdar@chef.io"]
27
27
  gem.description = "A streamlined development and deployment workflow for Chef platform."
28
28
  gem.summary = gem.description
29
+ gem.license = "Apache-2.0"
29
30
  gem.homepage = "https://www.chef.io/"
30
31
 
31
32
  gem.required_ruby_version = ">= 2.4"
@@ -55,5 +55,8 @@ ChefDK.commands do |c|
55
55
 
56
56
  c.builtin "undelete", :Undelete, desc: "Undo a delete command"
57
57
 
58
+ c.builtin "describe-cookbook", :DescribeCookbook, require_path: "chef-dk/command/describe_cookbook",
59
+ desc: "Prints cookbook checksum information used for cookbook identifier"
60
+
58
61
  c.builtin "verify", :Verify, desc: "Test the embedded ChefDK applications", hidden: true
59
62
  end
@@ -0,0 +1,95 @@
1
+ require "chef-dk/command/base"
2
+ require "chef-dk/ui"
3
+ require "chef-dk/cookbook_profiler/identifiers"
4
+
5
+ module ChefDK
6
+ class IdDumper
7
+
8
+ attr_reader :cb_path
9
+ attr_reader :ui
10
+
11
+ def initialize(ui, cb_relpath)
12
+ @ui = ui
13
+ @cb_path = cb_relpath
14
+ end
15
+
16
+ def run
17
+ id = ChefDK::CookbookProfiler::Identifiers.new(cookbook_version)
18
+ ui.msg "Path: #{cookbook_path}"
19
+ ui.msg "SemVer version: #{id.semver_version}"
20
+ ui.msg "Identifier: #{id.content_identifier}"
21
+ ui.msg "File fingerprints:"
22
+ ui.msg id.fingerprint_text
23
+ end
24
+
25
+ def cookbook_version
26
+ @cookbook_version ||= cookbook_loader.cookbook_version
27
+ end
28
+
29
+ def cookbook_path
30
+ File.expand_path(cb_path)
31
+ end
32
+
33
+ def cookbook_loader
34
+ @cookbook_loader ||=
35
+ begin
36
+ loader = Chef::Cookbook::CookbookVersionLoader.new(cookbook_path, chefignore)
37
+ loader.load!
38
+ loader
39
+ end
40
+ end
41
+
42
+ def chefignore
43
+ @chefignore ||= Chef::Cookbook::Chefignore.new(File.join(cookbook_path, "chefignore"))
44
+ end
45
+ end
46
+
47
+ module Command
48
+
49
+ class DescribeCookbook < ChefDK::Command::Base
50
+
51
+ banner "Usage: chef describe-cookbook <path/to/cookbook>"
52
+
53
+ attr_reader :cookbook_path
54
+ attr_reader :ui
55
+
56
+ def initialize(*args)
57
+ super
58
+ @cookbook_path = nil
59
+ @ui = UI.new
60
+ end
61
+
62
+ def run(params = [])
63
+ return 1 unless apply_params!(params)
64
+ return 1 unless check_cookbook_path
65
+ IdDumper.new(ui, cookbook_path).run
66
+ end
67
+
68
+ def check_cookbook_path
69
+ unless File.exist?(cookbook_path)
70
+ ui.err("Given cookbook path '#{cookbook_path}' does not exist or is not readable")
71
+ return false
72
+ end
73
+
74
+ md_path = File.join(cookbook_path, "metadata.rb")
75
+ unless File.exist?(md_path)
76
+ ui.err("Given cookbook path '#{cookbook_path}' does not appear to be a cookbook, it does not contain a metadata.rb")
77
+ return false
78
+ end
79
+ true
80
+ end
81
+
82
+ def apply_params!(params)
83
+ remaining_args = parse_options(params)
84
+ if remaining_args.size != 1
85
+ ui.err(opt_parser)
86
+ return false
87
+ else
88
+ @cookbook_path = File.expand_path(remaining_args.first)
89
+ true
90
+ end
91
+ end
92
+
93
+ end
94
+ end
95
+ end
@@ -104,7 +104,7 @@ module ChefDK
104
104
  given_policy_dirname = File.expand_path(File.dirname(new_file_path))
105
105
  @policyfile_dir =
106
106
  if chef_repo_mode? && (given_policy_dirname == Dir.pwd)
107
- File.expand_path("policies")
107
+ File.expand_path("policyfiles")
108
108
  else
109
109
  given_policy_dirname
110
110
  end
@@ -184,6 +184,15 @@ KITCHEN_YML
184
184
  end
185
185
  end
186
186
 
187
+ add_component "chef-apply" do |c|
188
+ c.gem_base_dir = "chef-apply"
189
+ c.unit_test do
190
+ bundle_install_mutex.synchronize { sh("#{embedded_bin("bundle")} install") }
191
+ sh("#{embedded_bin("bundle")} exec rspec")
192
+ end
193
+ c.smoke_test { sh("#{bin("chef-run")} -v") }
194
+ end
195
+
187
196
  # entirely possible this needs to be driven by a utility method in chef-provisioning.
188
197
  add_component "chef-provisioning" do |c|
189
198
  c.gem_base_dir = "chef-dk"
@@ -5,20 +5,20 @@ the same filename as the name set in the policyfile itself, and use the
5
5
  Compile the policy with a command like this:
6
6
 
7
7
  ```
8
- chef install policies/my-app-frontend.rb
8
+ chef install policyfiles/my-app-frontend.rb
9
9
  ```
10
10
 
11
- This will create a lockfile `policies/my-app-frontend.lock.json`.
11
+ This will create a lockfile `policyfiles/my-app-frontend.lock.json`.
12
12
 
13
13
  To update locked dependencies, run `chef update` like this:
14
14
 
15
15
  ```
16
- chef update policies/my-app-frontend.rb
16
+ chef update policyfiles/my-app-frontend.rb
17
17
  ```
18
18
 
19
19
  You can upload the policy (with associated cookbooks) to the server
20
20
  using a command like:
21
21
 
22
22
  ```
23
- chef push staging policies/my-app-frontend.rb
23
+ chef push staging policyfiles/my-app-frontend.rb
24
24
  ```
@@ -32,7 +32,7 @@ directories_to_create = %w( cookbooks data_bags )
32
32
  directories_to_create += if context.use_roles
33
33
  %w( roles environments )
34
34
  else
35
- %w( policies )
35
+ %w( policyfiles )
36
36
  end
37
37
 
38
38
  directories_to_create.each do |tlo|
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module ChefDK
19
- VERSION = "3.1.0"
19
+ VERSION = "3.2.30"
20
20
  end
@@ -22,4 +22,4 @@ override "util-macros", version: "1.19.0"
22
22
  override "xproto", version: "7.0.28"
23
23
  override "zlib", version: "1.2.11"
24
24
  override "libzmq", version: "4.0.7"
25
- override "openssl", version: "1.0.2o"
25
+ override "openssl", version: "1.0.2p"
@@ -111,7 +111,7 @@ describe ChefDK::Command::GeneratorCommands::Policyfile do
111
111
 
112
112
  let(:chef_repo_dot_txt) { File.join(tempdir, ".chef-repo.txt") }
113
113
 
114
- let(:policies_dir) { File.join(tempdir, "policies") }
114
+ let(:policies_dir) { File.join(tempdir, "policyfiles") }
115
115
 
116
116
  let(:expected_policyfile_content) do
117
117
  <<-POLICYFILE_RB
@@ -291,9 +291,9 @@ describe ChefDK::Command::GeneratorCommands::Repo do
291
291
  expect(File).to_not exist(File.join(repo_path, "environments"))
292
292
  end
293
293
 
294
- describe "policies" do
294
+ describe "policyfiles" do
295
295
  describe "README.md" do
296
- let(:file) { "policies/README.md" }
296
+ let(:file) { "policyfiles/README.md" }
297
297
 
298
298
  let(:expected_content) do
299
299
  <<-README
@@ -315,8 +315,8 @@ README
315
315
 
316
316
  let(:argv) { %w{new_repo --roles} }
317
317
 
318
- it "does not create a policies directory" do
319
- expect(File).to_not exist(File.join(repo_path, "policies"))
318
+ it "does not create a policyfiles directory" do
319
+ expect(File).to_not exist(File.join(repo_path, "policyfiles"))
320
320
  end
321
321
 
322
322
  describe "roles" do
@@ -42,6 +42,7 @@ describe ChefDK::Command::Verify do
42
42
  "tk-policyfile-provisioner",
43
43
  "chef-client",
44
44
  "chef-dk",
45
+ "chef-apply",
45
46
  "chef-provisioning",
46
47
  "chefspec",
47
48
  "generated-cookbooks-pass-chefspec",
@@ -137,9 +137,9 @@ describe ChefDK::Policyfile::IncludedPoliciesCookbookSource do
137
137
  end
138
138
  end
139
139
 
140
- let(:policies) { [] }
140
+ let(:policyfiles) { [] }
141
141
 
142
- let(:cookbook_source) { ChefDK::Policyfile::IncludedPoliciesCookbookSource.new(policies) }
142
+ let(:cookbook_source) { ChefDK::Policyfile::IncludedPoliciesCookbookSource.new(policyfiles) }
143
143
 
144
144
  context "when no policies are included" do
145
145
  it "returns false for preferred_source_for" do
@@ -152,7 +152,7 @@ describe ChefDK::Policyfile::IncludedPoliciesCookbookSource do
152
152
  end
153
153
 
154
154
  context "when a single policy is to be included" do
155
- let(:policies) { [policy1_location_spec] }
155
+ let(:policyfiles) { [policy1_location_spec] }
156
156
 
157
157
  it "does not have a preferred source for unlocked cookbooks" do
158
158
  expect(cookbook_source.preferred_source_for?("cookbookC")).to eq(false)
@@ -185,7 +185,7 @@ describe ChefDK::Policyfile::IncludedPoliciesCookbookSource do
185
185
  end
186
186
 
187
187
  context "when multiple policies are to be included" do
188
- let(:policies) { [policy1_location_spec, policy2_location_spec] }
188
+ let(:policyfiles) { [policy1_location_spec, policy2_location_spec] }
189
189
 
190
190
  context "when the policies use the same cookbooks with the same versions and sources" do
191
191
  let(:policy2_cookbooks) { policy1_cookbooks + [{ name: "cookbookC", version: "2.0.0" }] }
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright (c) 2016-2017, Chef Software Inc.
2
+ # Copyright:: Copyright 2016-2018, Chef Software Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright (c) 2016-2017, Chef Software Inc.
2
+ # Copyright:: Copyright (c) 2016-2018, Chef Software Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,30 +15,15 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
+ require "bundler"
19
+
18
20
  desc "Tasks to update and check dependencies"
19
21
  namespace :dependencies do
20
-
21
- # Running update_ci on your local system wont' work. The best way to update
22
- # dependencies locally is by running the dependency update script.
23
- desc "Update all dependencies. dependencies:update to update as little as possible."
24
- task :update do |t, rake_args|
25
- # FIXME: probably broken, and needs less indirection
26
- system("#{File.join(Dir.pwd, "ci", "dependency_update.sh")}")
27
- end
28
-
29
- desc "Force update (when adding new gems to Gemfiles)"
30
- task :force_update do |t, rake_args|
31
- # FIXME: probably broken, and needs less indirection
32
- FileUtils.rm_f(File.join(Dir.pwd, ".bundle", "config"))
33
- system("#{File.join(Dir.pwd, "ci", "dependency_update.sh")}")
34
- end
35
-
36
22
  # Update all dependencies to the latest constraint-matching version
37
- desc "Update all dependencies. dependencies:update to update as little as possible (CI-only)."
38
- task :update_ci => %w{
23
+ desc "Update all dependencies."
24
+ task update: %w{
39
25
  dependencies:update_gemfile_lock
40
26
  dependencies:update_omnibus_gemfile_lock
41
- dependencies:update_acceptance_gemfile_lock
42
27
  }
43
28
 
44
29
  def bundle_update_locked_multiplatform_task(task_name, dir)
@@ -66,24 +51,6 @@ namespace :dependencies do
66
51
  end
67
52
  end
68
53
 
69
- def berks_update_task(task_name, dir)
70
- desc "Update #{dir}/Berksfile.lock."
71
- task task_name do
72
- FileUtils.rm_f("#{dir}/Berksfile.lock")
73
- Dir.chdir(dir) do
74
- Bundler.with_clean_env do
75
- sh "bundle exec berks install"
76
- end
77
- end
78
- end
79
- end
80
-
81
54
  bundle_update_locked_multiplatform_task :update_gemfile_lock, "."
82
55
  bundle_update_locked_multiplatform_task :update_omnibus_gemfile_lock, "omnibus"
83
- bundle_update_task :update_acceptance_gemfile_lock, "acceptance"
84
56
  end
85
-
86
- desc "Update all dependencies and check for outdated gems."
87
- task :dependencies_ci => [ "dependencies:update_ci" ]
88
- task :dependencies => [ "dependencies:update" ]
89
- task :update => [ "dependencies:update" ]