chef 12.9.41 → 12.10.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +52 -13
  3. data/README.md +145 -0
  4. data/Rakefile +4 -14
  5. data/VERSION +1 -1
  6. data/acceptance/.gitignore +0 -1
  7. data/acceptance/Gemfile +2 -2
  8. data/acceptance/Gemfile.lock +235 -0
  9. data/acceptance/fips/.kitchen.yml +5 -1
  10. data/acceptance/fips/test/integration/{fips → fips-integration}/serverspec/Gemfile +0 -0
  11. data/acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb +51 -0
  12. data/acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile +3 -0
  13. data/acceptance/fips/test/integration/fips-unit-functional/serverspec/fips-unit-functional_spec.rb +56 -0
  14. data/{chef-windows.gemspec → chef-universal-mingw32.gemspec} +0 -0
  15. data/chef.gemspec +0 -6
  16. data/{lib → lib-backcompat}/chef/chef_fs/file_system/already_exists_error.rb +0 -0
  17. data/{lib → lib-backcompat}/chef/chef_fs/file_system/cookbook_frozen_error.rb +0 -0
  18. data/{lib → lib-backcompat}/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb +0 -0
  19. data/{lib → lib-backcompat}/chef/chef_fs/file_system/file_system_error.rb +0 -0
  20. data/{lib → lib-backcompat}/chef/chef_fs/file_system/must_delete_recursively_error.rb +0 -0
  21. data/{lib → lib-backcompat}/chef/chef_fs/file_system/not_found_error.rb +0 -0
  22. data/{lib → lib-backcompat}/chef/chef_fs/file_system/operation_failed_error.rb +0 -0
  23. data/{lib → lib-backcompat}/chef/chef_fs/file_system/operation_not_allowed_error.rb +0 -0
  24. data/lib-backcompat/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb +5 -0
  25. data/lib-backcompat/chef/chef_fs/file_system/repository/chef_repository_file_system_client_keys_dir.rb +5 -0
  26. data/lib-backcompat/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb +6 -0
  27. data/lib-backcompat/chef/chef_fs/file_system/repository/chef_repository_file_system_policies_dir.rb +5 -0
  28. data/{lib → lib-backcompat}/chef/chef_fs/file_system/repository/file_system_root_dir.rb +1 -0
  29. data/lib/chef/chef_fs/file_system/repository/acl.rb +38 -0
  30. data/lib/chef/chef_fs/file_system/repository/{chef_repository_file_system_acls_dir.rb → acls_dir.rb} +14 -5
  31. data/lib/chef/chef_fs/file_system/repository/acls_sub_dir.rb +42 -0
  32. data/lib/chef/chef_fs/file_system/repository/base_file.rb +120 -0
  33. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +1 -1
  34. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +36 -32
  35. data/lib/chef/chef_fs/file_system/repository/client.rb +38 -0
  36. data/lib/chef/chef_fs/file_system/repository/client_key.rb +38 -0
  37. data/lib/chef/chef_fs/file_system/repository/{chef_repository_file_system_client_keys_dir.rb → client_keys_dir.rb} +9 -5
  38. data/lib/chef/chef_fs/file_system/repository/client_keys_sub_dir.rb +42 -0
  39. data/lib/chef/chef_fs/file_system/repository/clients_dir.rb +40 -0
  40. data/lib/chef/chef_fs/file_system/repository/container.rb +38 -0
  41. data/lib/chef/chef_fs/file_system/repository/containers_dir.rb +41 -0
  42. data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +0 -1
  43. data/lib/chef/chef_fs/file_system/repository/data_bag_item.rb +3 -79
  44. data/lib/chef/chef_fs/file_system/repository/directory.rb +15 -2
  45. data/lib/chef/chef_fs/file_system/repository/environment.rb +38 -0
  46. data/lib/chef/chef_fs/file_system/repository/environments_dir.rb +41 -0
  47. data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +66 -30
  48. data/lib/chef/chef_fs/file_system/repository/group.rb +38 -0
  49. data/lib/chef/chef_fs/file_system/repository/groups_dir.rb +41 -0
  50. data/lib/chef/chef_fs/file_system/repository/node.rb +38 -0
  51. data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +41 -0
  52. data/lib/chef/chef_fs/file_system/repository/{chef_repository_file_system_policies_dir.rb → policies_dir.rb} +9 -5
  53. data/lib/chef/chef_fs/file_system/repository/policy.rb +38 -0
  54. data/lib/chef/chef_fs/file_system/repository/policy_group.rb +38 -0
  55. data/lib/chef/chef_fs/file_system/repository/policy_groups_dir.rb +41 -0
  56. data/lib/chef/chef_fs/file_system/repository/role.rb +38 -0
  57. data/lib/chef/chef_fs/file_system/repository/roles_dir.rb +41 -0
  58. data/lib/chef/chef_fs/file_system/repository/user.rb +38 -0
  59. data/lib/chef/chef_fs/file_system/repository/users_dir.rb +41 -0
  60. data/lib/chef/dsl/declare_resource.rb +182 -7
  61. data/lib/chef/http/json_input.rb +2 -2
  62. data/lib/chef/knife.rb +1 -1
  63. data/lib/chef/mixin/shell_out.rb +10 -21
  64. data/lib/chef/property.rb +9 -2
  65. data/lib/chef/provider.rb +8 -7
  66. data/lib/chef/provider/apt_repository.rb +8 -6
  67. data/lib/chef/provider/directory.rb +15 -1
  68. data/lib/chef/provider/env/windows.rb +1 -1
  69. data/lib/chef/provider/mdadm.rb +1 -0
  70. data/lib/chef/provider/package/easy_install.rb +2 -0
  71. data/lib/chef/provider/package/rubygems.rb +4 -1
  72. data/lib/chef/provider/package/windows.rb +1 -1
  73. data/lib/chef/recipe.rb +1 -2
  74. data/lib/chef/resource/apt_repository.rb +6 -6
  75. data/lib/chef/resource/mdadm.rb +9 -0
  76. data/lib/chef/resource_collection.rb +5 -0
  77. data/lib/chef/resource_collection/resource_list.rb +10 -0
  78. data/lib/chef/resource_collection/resource_set.rb +14 -11
  79. data/lib/chef/version.rb +1 -1
  80. data/spec/functional/resource/git_spec.rb +1 -3
  81. data/spec/functional/resource/group_spec.rb +5 -5
  82. data/spec/functional/tiny_server_spec.rb +1 -1
  83. data/spec/functional/util/powershell/cmdlet_spec.rb +1 -1
  84. data/spec/functional/win32/registry_spec.rb +3 -3
  85. data/spec/integration/solo/solo_spec.rb +2 -2
  86. data/spec/support/shared/functional/securable_resource.rb +1 -1
  87. data/spec/support/shared/unit/provider/file.rb +3 -3
  88. data/spec/support/shared/unit/windows_script_resource.rb +1 -1
  89. data/spec/unit/application/apply_spec.rb +1 -0
  90. data/spec/unit/chef_fs/file_system/repository/base_file_spec.rb +128 -0
  91. data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +174 -0
  92. data/spec/unit/cookbook/metadata_spec.rb +1 -1
  93. data/spec/unit/dsl/declare_resource_spec.rb +335 -0
  94. data/spec/unit/knife/bootstrap_spec.rb +2 -2
  95. data/spec/unit/mixin/shell_out_spec.rb +4 -0
  96. data/spec/unit/node/attribute_spec.rb +1 -1
  97. data/spec/unit/node/immutable_collections_spec.rb +2 -2
  98. data/spec/unit/node_map_spec.rb +1 -1
  99. data/spec/unit/property/validation_spec.rb +23 -7
  100. data/spec/unit/provider/apt_repository_spec.rb +5 -0
  101. data/spec/unit/provider/apt_update_spec.rb +1 -0
  102. data/spec/unit/provider/directory_spec.rb +0 -7
  103. data/spec/unit/provider/file/content_spec.rb +1 -1
  104. data/spec/unit/provider/mdadm_spec.rb +9 -0
  105. data/spec/unit/provider/package/easy_install_spec.rb +6 -0
  106. data/spec/unit/provider/package/rubygems_spec.rb +8 -4
  107. data/spec/unit/provider/package/yum_spec.rb +1 -1
  108. data/spec/unit/provider/powershell_script_spec.rb +1 -1
  109. data/spec/unit/provider/user/dscl_spec.rb +6 -6
  110. data/spec/unit/recipe_spec.rb +1 -0
  111. data/spec/unit/resource/apt_repository_spec.rb +4 -0
  112. data/spec/unit/resource/file/verification_spec.rb +1 -1
  113. data/spec/unit/resource/file_spec.rb +2 -2
  114. data/spec/unit/resource/mdadm_spec.rb +7 -2
  115. data/spec/unit/resource_collection_spec.rb +30 -0
  116. data/spec/unit/resource_spec.rb +1 -1
  117. data/tasks/bin/bundle-platform +15 -0
  118. data/tasks/bin/bundle-platform.bat +2 -0
  119. data/tasks/bin/create-override-gemfile +110 -0
  120. data/tasks/bin/run_chef_tests +17 -0
  121. data/tasks/bin/run_external_test +47 -0
  122. data/tasks/bundle.rb +97 -0
  123. data/tasks/bundle_util.rb +94 -0
  124. data/tasks/changelog.rb +12 -0
  125. data/tasks/dependencies.rb +147 -0
  126. data/tasks/gemfile_util.rb +390 -0
  127. data/tasks/maintainers.rb +2 -1
  128. data/tasks/rspec.rb +2 -1
  129. metadata +61 -83
  130. data/acceptance/fips/test/integration/fips/serverspec/fips_spec.rb +0 -39
  131. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb +0 -83
  132. data/tasks/external_tests.rb +0 -64
@@ -0,0 +1,390 @@
1
+ require "rubygems"
2
+ require "bundler"
3
+ require "shellwords"
4
+ require "set"
5
+
6
+ module GemfileUtil
7
+ #
8
+ # Adds `override: true`, which allows your statement to override any other
9
+ # gem statement about the same gem in the Gemfile.
10
+ #
11
+ def gem(name, *args)
12
+ options = args[-1].is_a?(Hash) ? args[-1] : {}
13
+
14
+ # Unless we're finished with everything, ignore gems that are being overridden
15
+ unless overridden_gems == :finished
16
+ # If it's a path or override gem, it overrides whatever else is there.
17
+ if options[:path] || options[:override]
18
+ options.delete(:override)
19
+ warn_if_replacing(name, overridden_gems[name], args)
20
+ overridden_gems[name] = args
21
+ return
22
+
23
+ # If there's an override gem, and we're *not* an override gem, don't do anything
24
+ elsif overridden_gems[name]
25
+ warn_if_replacing(name, args, overridden_gems[name])
26
+ return
27
+ end
28
+ end
29
+
30
+ # Otherwise, add the gem normally
31
+ super
32
+ rescue
33
+ puts $!.backtrace
34
+ raise
35
+ end
36
+
37
+ def overridden_gems
38
+ @overridden_gems ||= {}
39
+ end
40
+
41
+ #
42
+ # Just before we finish the Gemfile, finish up the override gems
43
+ #
44
+ def to_definition(*args)
45
+ complete_overrides
46
+ super
47
+ end
48
+
49
+ def complete_overrides
50
+ to_override = overridden_gems
51
+ unless to_override == :finished
52
+ @overridden_gems = :finished
53
+ to_override.each do |name, args|
54
+ gem name, *args
55
+ end
56
+ end
57
+ end
58
+
59
+ #
60
+ # Include all gems in the locked gemfile.
61
+ #
62
+ # @param gemfile_path Path to the Gemfile to load (relative to your Gemfile)
63
+ # @param lockfile_path Path to the Gemfile to load (relative to your Gemfile).
64
+ # Defaults to <gemfile_path>.lock.
65
+ # @param groups A list of groups to include (whitelist). If not passed (or set
66
+ # to nil), all gems will be selected.
67
+ # @param without_groups A list of groups to ignore. Gems will be excluded from
68
+ # the results if all groups they belong to are ignored. This matches
69
+ # bundler's `without` behavior.
70
+ # @param gems A list of gems to include above and beyond the given groups.
71
+ # Gems in this list must be explicitly included in the Gemfile
72
+ # with a `gem "gem_name", ...` line or they will be silently
73
+ # ignored.
74
+ # @param copy_groups Whether to copy the groups over from the old lockfile to
75
+ # the new. Use this when the new lockfile has the same convention for
76
+ # groups as the old. Defaults to `false`.
77
+ #
78
+ def include_locked_gemfile(gemfile_path, lockfile_path = "#{gemfile_path}.lock", groups: nil, without_groups: nil, gems: [], copy_groups: false)
79
+ # Parse the desired lockfile
80
+ gemfile_path = Pathname.new(gemfile_path).expand_path(Bundler.default_gemfile.dirname).realpath
81
+ lockfile_path = Pathname.new(lockfile_path).expand_path(Bundler.default_gemfile.dirname).realpath
82
+
83
+ # Calculate relative_to
84
+ relative_to = Bundler.default_gemfile.dirname.realpath
85
+
86
+ # Call out to create-override-gemfile to read the Gemfile+Gemfile.lock (bundler does not work well if you do two things in one process)
87
+ create_override_gemfile_bin = File.expand_path("../bin/create-override-gemfile", __FILE__)
88
+ arguments = [
89
+ "--gemfile", gemfile_path,
90
+ "--lockfile", lockfile_path,
91
+ "--override"
92
+ ]
93
+ arguments += [ "--relative-to", relative_to ] if relative_to != "."
94
+ arguments += Array(groups).flat_map { |group| [ "--group", group ] }
95
+ arguments += Array(without_groups).flat_map { |without| [ "--without", without ] }
96
+ arguments += Array(gems).flat_map { |name| [ "--gem", name ] }
97
+ arguments << "--copy-groups" if copy_groups
98
+ cmd = Shellwords.join([ Gem.ruby, "-S", create_override_gemfile_bin, *arguments ])
99
+ output = nil
100
+ Bundler.ui.info("> #{cmd}")
101
+ Bundler.with_clean_env do
102
+ output = `#{cmd}`
103
+ end
104
+ instance_eval(output, cmd, 1)
105
+ end
106
+
107
+ #
108
+ # Include all gems in the locked gemfile.
109
+ #
110
+ # @param current_gemfile The Gemfile you are currently loading (`self`).
111
+ # @param gemfile_path Path to the Gemfile to load (relative to your Gemfile)
112
+ # @param lockfile_path Path to the Gemfile to load (relative to your Gemfile).
113
+ # Defaults to <gemfile_path>.lock.
114
+ # @param groups A list of groups to include (whitelist). If not passed (or set
115
+ # to nil), all gems will be selected.
116
+ # @param without_groups A list of groups to ignore. Gems will be excluded from
117
+ # the results if all groups they belong to are ignored. This matches
118
+ # bundler's `without` behavior.
119
+ # @param gems A list of gems to include above and beyond the given groups.
120
+ # Gems in this list must be explicitly included in the Gemfile
121
+ # with a `gem "gem_name", ...` line or they will be silently
122
+ # ignored.
123
+ # @param copy_groups Whether to copy the groups over from the old lockfile to
124
+ # the new. Use this when the new lockfile has the same convention for
125
+ # groups as the old. Defaults to `false`.
126
+ #
127
+ def self.include_locked_gemfile(current_gemfile, gemfile_path, lockfile_path = "#{gemfile_path}.lock", groups: nil, without_groups: nil, gems: [], copy_groups: false)
128
+ current_gemfile.instance_eval do
129
+ extend GemfileUtil
130
+ include_locked_gemfile(gemfile_path, lockfile_path, groups: groups, without_groups: without_groups, gems: gems, copy_groups: copy_groups)
131
+ end
132
+ end
133
+
134
+ def warn_if_replacing(name, old_args, new_args)
135
+ return if !old_args || !new_args
136
+ if args_to_dep(name, *old_args) =~ args_to_dep(name, *new_args)
137
+ Bundler.ui.debug "Replaced Gemfile dependency #{name} (#{old_args}) with (#{new_args})"
138
+ else
139
+ Bundler.ui.warn "Replaced Gemfile dependency #{name} (#{old_args}) with (#{new_args})"
140
+ end
141
+ end
142
+
143
+ def args_to_dep(name, *version, **options)
144
+ version = [">= 0"] if version.empty?
145
+ Bundler::Dependency.new(name, version, options)
146
+ end
147
+
148
+ #
149
+ # Reads a bundle, including a gemfile and lockfile.
150
+ #
151
+ # Does no validation, does not update the lockfile or its gems in any way.
152
+ #
153
+ class Bundle
154
+ #
155
+ # Parse the given gemfile/lockfile pair.
156
+ #
157
+ # @return [Bundle] The parsed bundle.
158
+ #
159
+ def self.parse(gemfile_path, lockfile_path = "#{gemfile_path}.lock")
160
+ result = new(gemfile_path, lockfile_path)
161
+ result.gems
162
+ result
163
+ end
164
+
165
+ #
166
+ # Create a new Bundle to parse the given gemfile/lockfile pair.
167
+ #
168
+ def initialize(gemfile_path, lockfile_path = "#{gemfile_path}.lock")
169
+ @gemfile_path = gemfile_path
170
+ @lockfile_path = lockfile_path
171
+ end
172
+
173
+ #
174
+ # The path to the Gemfile
175
+ #
176
+ attr_reader :gemfile_path
177
+
178
+ #
179
+ # The path to the Lockfile
180
+ #
181
+ attr_reader :lockfile_path
182
+
183
+ #
184
+ # The list of gems.
185
+ #
186
+ # @return [Hash<String, Hash>] The resulting gems, where key = gem_name, and the
187
+ # hash has:
188
+ # - version: version of the gem.
189
+ # - source info (:source/:git/:ref/:path) from the lockfile
190
+ # - dependencies: A list of gem names this gem has a runtime
191
+ # dependency on. Dependencies are transitive: if A depends on B,
192
+ # and B depends on C, then A has C in its :dependencies list.
193
+ # - development_dependencies: - A list of gem names this gem has a
194
+ # development dependency on. Dependencies are transitive: if A
195
+ # depends on B, and B depends on C, then A has C in its
196
+ # :development_dependencies list. development dependencies *include*
197
+ # runtime dependencies.
198
+ # - groups: The list of groups (symbols) this gem is in. Groups
199
+ # are transitive: if A has a runtime dependency on B, and A is
200
+ # in group X, then B is also in group X.
201
+ # - declared_groups: The list of groups (symbols) this gem was
202
+ # declared in the Gemfile.
203
+ #
204
+ def gems
205
+ @gems ||= begin
206
+ gems = locks.dup
207
+ gems.each do |name, g|
208
+ if gem_declarations.has_key?(name)
209
+ g[:declared_groups] = gem_declarations[name][:groups]
210
+ else
211
+ g[:declared_groups] = []
212
+ end
213
+ g[:groups] = g[:declared_groups].dup
214
+ end
215
+ # Transitivize groups (since dependencies are already transitive, this is easy)
216
+ gems.each do |name, g|
217
+ g[:dependencies].each do |dep|
218
+ gems[dep][:groups] |= gems[name][:declared_groups].dup
219
+ end
220
+ end
221
+ gems
222
+ end
223
+ end
224
+
225
+ #
226
+ # Get the gems (and their deps) in the given group.
227
+ #
228
+ # @param groups A list of groups to include (whitelist). If not passed (or set
229
+ # to nil), all gems will be selected.
230
+ # @param without_groups A list of groups to ignore. Gems will be excluded from
231
+ # the results if all groups they belong to are ignored.
232
+ # This matches bundler's `without` behavior.
233
+ # @param gems A list of gems to include regardless of what groups are included.
234
+ #
235
+ # @return Hash[String, Hash] The resulting gems, where key = gem_name, and the
236
+ # hash has:
237
+ # - version: version of the gem.
238
+ # - source info (:source/:git/:ref/:path) from the lockfile
239
+ # - dependencies: A list of gem names this gem has a runtime
240
+ # dependency on. Dependencies are transitive: if A depends on B,
241
+ # and B depends on C, then A has C in its :dependencies list.
242
+ # - development_dependencies: - A list of gem names this gem has a
243
+ # development dependency on. Dependencies are transitive: if A
244
+ # depends on B, and B depends on C, then A has C in its
245
+ # :development_dependencies list. development dependencies
246
+ # *include* runtime dependencies.
247
+ # - groups: The list of groups (symbols) this gem is in. Groups
248
+ # are transitive: if A has a runtime dependency on B, and A is
249
+ # in group X, then B is also in group X.
250
+ # - declared_groups: The list of groups (symbols) this gem was
251
+ # declared in the Gemfile.
252
+ #
253
+ def select_gems(groups: nil, without_groups: nil)
254
+ # First, select the gems that match
255
+ result = {}
256
+ gems.each do |name, g|
257
+ dep_groups = g[:declared_groups] - [ :only_a_runtime_dependency_of_other_gems ]
258
+ dep_groups = dep_groups & groups if groups
259
+ dep_groups = dep_groups - without_groups if without_groups
260
+ if dep_groups.any?
261
+ result[name] ||= g
262
+ g[:dependencies].each do |dep|
263
+ result[dep] ||= gems[dep]
264
+ end
265
+ end
266
+ end
267
+ result
268
+ end
269
+
270
+ #
271
+ # Get all locks from the given lockfile.
272
+ #
273
+ # @return Hash[String, Hash] The resulting gems, where key = gem_name, and the
274
+ # hash has:
275
+ # - version: version of the gem.
276
+ # - source info (:source/:git/:ref/:path)
277
+ # - dependencies: A list of gem names this gem has a runtime
278
+ # dependency on. Dependencies are transitive: if A depends on B,
279
+ # and B depends on C, then A has C in its :dependencies list.
280
+ # - development_dependencies: - A list of gem names this gem has a
281
+ # development dependency on. Dependencies are transitive: if A
282
+ # depends on B, and B depends on C, then A has C in its
283
+ # :development_dependencies list. development dependencies *include*
284
+ # runtime dependencies.
285
+ #
286
+ def locks
287
+ @locks ||= begin
288
+ # Grab all the specs from the lockfile
289
+ locks = {}
290
+ parsed_lockfile = Bundler::LockfileParser.new(IO.read(lockfile_path))
291
+ parsed_lockfile.specs.each do |spec|
292
+ # Never include bundler, it can't be bundled and doesn't put itself in
293
+ # the lockfile correctly anyway
294
+ next if spec.name == "bundler"
295
+ # Only the platform-specific locks for now (TODO make it possible to emit all locks)
296
+ next if spec.platform && spec.platform != Gem::Platform::RUBY
297
+ lock = lock_source_metadata(spec)
298
+ lock[:version] = spec.version.to_s
299
+ runtime = spec.dependencies.select { |dep| dep.type == :runtime }
300
+ lock[:dependencies] = Set.new(runtime.map { |dep| dep.name })
301
+ lock[:development_dependencies] = Set.new(spec.dependencies.map { |dep| dep.name })
302
+ lock[:dependencies].delete("bundler")
303
+ lock[:development_dependencies].delete("bundler")
304
+ locks[spec.name] = lock
305
+ end
306
+
307
+ # Transitivize the deps.
308
+ locks.each do |name, lock|
309
+ # Not all deps were brought over (platform-specific ones) so weed them out
310
+ lock[:dependencies] &= locks.keys
311
+ lock[:development_dependencies] &= locks.keys
312
+
313
+ lock[:dependencies] = transitive_dependencies(locks, name, :dependencies)
314
+ lock[:development_dependencies] = transitive_dependencies(locks, name, :development_dependencies)
315
+ end
316
+
317
+ locks
318
+ end
319
+ end
320
+
321
+ #
322
+ # Get all desired gems, sans dependencies, from the gemfile.
323
+ #
324
+ # @param gemfile Path to the Gemfile to load
325
+ #
326
+ # @return Hash<String, Hash> An array of hashes where key = gem name and value
327
+ # has :groups (an array of symbols representing the groups the gem
328
+ # is in). :groups are not transitive, since we don't know the
329
+ # dependency tree yet.
330
+ #
331
+ def gem_declarations
332
+ @gem_declarations ||= begin
333
+ Bundler.with_clean_env do
334
+ # Set BUNDLE_GEMFILE to the new gemfile temporarily so all bundler's things work
335
+ # This works around some issues in bundler 1.11.2.
336
+ ENV["BUNDLE_GEMFILE"] = gemfile_path
337
+
338
+ parsed_gemfile = Bundler::Dsl.new
339
+ parsed_gemfile.eval_gemfile(gemfile_path)
340
+ parsed_gemfile.complete_overrides if parsed_gemfile.respond_to?(:complete_overrides)
341
+
342
+ result = {}
343
+ parsed_gemfile.dependencies.each do |dep|
344
+ groups = dep.groups.empty? ? [:default] : dep.groups
345
+ result[dep.name] = { groups: groups, platforms: dep.platforms }
346
+ end
347
+ result
348
+ end
349
+ end
350
+ end
351
+
352
+ private
353
+
354
+ #
355
+ # Given a bunch of locks (name -> { dependencies: [name,name] }) and a
356
+ # dependency name, add its dependencies to the result transitively.
357
+ #
358
+ def transitive_dependencies(locks, name, dep_key, result = Set.new)
359
+ locks[name][dep_key].each do |dep|
360
+ # Only ever add a dep once, so we don't infinitely recurse
361
+ if result.add?(dep)
362
+ transitive_dependencies(locks, dep, dep_key, result)
363
+ end
364
+ end
365
+ result
366
+ end
367
+
368
+ #
369
+ # Get source and version metadata for the given Bundler spec (coming from a lockfile).
370
+ #
371
+ # @return Hash { version: <version>, git: <git>, path: <path>, source: <source>, ref: <ref> }
372
+ #
373
+ def lock_source_metadata(spec)
374
+ # Copy source information from included Gemfile
375
+ result = {}
376
+ case spec.source
377
+ when Bundler::Source::Rubygems
378
+ result[:source] = spec.source.remotes.first.to_s
379
+ when Bundler::Source::Git
380
+ result[:git] = spec.source.uri.to_s
381
+ result[:ref] = spec.source.revision
382
+ when Bundler::Source::Path
383
+ result[:path] = spec.source.path.to_s
384
+ else
385
+ raise "Unknown source #{spec.source} for gem #{spec.name}"
386
+ end
387
+ result
388
+ end
389
+ end
390
+ end
@@ -31,9 +31,10 @@ begin
31
31
  require "tomlrb"
32
32
  require "octokit"
33
33
  require "pp"
34
- task :default => :generate
35
34
 
36
35
  namespace :maintainers do
36
+ task :default => :generate
37
+
37
38
  desc "Generate MarkDown version of MAINTAINERS file"
38
39
  task :generate do
39
40
  out = "<!-- This is a generated file. Please do not edit directly -->\n\n"
@@ -73,7 +73,8 @@ begin
73
73
  desc "Run the specs under spec/unit with activesupport loaded"
74
74
  RSpec::Core::RakeTask.new(:activesupport) do |t|
75
75
  t.rspec_opts = %w{--require active_support/core_ext --profile}
76
- t.pattern = FileList["spec/unit/**/*_spec.rb"]
76
+ # Only node_spec and role_spec specifically have issues, target those tests
77
+ t.pattern = FileList["spec/unit/node_spec.rb", "spec/unit/role_spec.rb"]
77
78
  end
78
79
 
79
80
  [:unit, :functional, :integration, :stress].each do |sub|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.9.41
4
+ version: 12.10.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-03 00:00:00.000000000 Z
11
+ date: 2016-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 12.9.41
19
+ version: 12.10.24
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 12.9.41
26
+ version: 12.10.24
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mixlib-cli
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -390,68 +390,6 @@ dependencies:
390
390
  - - ">="
391
391
  - !ruby/object:Gem::Version
392
392
  version: '1.10'
393
- - !ruby/object:Gem::Dependency
394
- name: rack
395
- requirement: !ruby/object:Gem::Requirement
396
- requirements:
397
- - - ">="
398
- - !ruby/object:Gem::Version
399
- version: '0'
400
- type: :development
401
- prerelease: false
402
- version_requirements: !ruby/object:Gem::Requirement
403
- requirements:
404
- - - ">="
405
- - !ruby/object:Gem::Version
406
- version: '0'
407
- - !ruby/object:Gem::Dependency
408
- name: cheffish
409
- requirement: !ruby/object:Gem::Requirement
410
- requirements:
411
- - - ">="
412
- - !ruby/object:Gem::Version
413
- version: '1.1'
414
- - - "<"
415
- - !ruby/object:Gem::Version
416
- version: '3.0'
417
- type: :development
418
- prerelease: false
419
- version_requirements: !ruby/object:Gem::Requirement
420
- requirements:
421
- - - ">="
422
- - !ruby/object:Gem::Version
423
- version: '1.1'
424
- - - "<"
425
- - !ruby/object:Gem::Version
426
- version: '3.0'
427
- - !ruby/object:Gem::Dependency
428
- name: github_changelog_generator
429
- requirement: !ruby/object:Gem::Requirement
430
- requirements:
431
- - - '='
432
- - !ruby/object:Gem::Version
433
- version: 1.11.3
434
- type: :development
435
- prerelease: false
436
- version_requirements: !ruby/object:Gem::Requirement
437
- requirements:
438
- - - '='
439
- - !ruby/object:Gem::Version
440
- version: 1.11.3
441
- - !ruby/object:Gem::Dependency
442
- name: rake
443
- requirement: !ruby/object:Gem::Requirement
444
- requirements:
445
- - - "~>"
446
- - !ruby/object:Gem::Version
447
- version: '10.1'
448
- type: :development
449
- prerelease: false
450
- version_requirements: !ruby/object:Gem::Requirement
451
- requirements:
452
- - - "~>"
453
- - !ruby/object:Gem::Version
454
- version: '10.1'
455
393
  description: A systems integration framework, built to bring the benefits of configuration
456
394
  management to your entire infrastructure.
457
395
  email: adam@chef.io
@@ -480,6 +418,7 @@ files:
480
418
  - acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb
481
419
  - acceptance/.shared/kitchen_acceptance/metadata.rb
482
420
  - acceptance/Gemfile
421
+ - acceptance/Gemfile.lock
483
422
  - acceptance/README.md
484
423
  - acceptance/basics/.acceptance/acceptance-cookbook/.gitignore
485
424
  - acceptance/basics/.acceptance/acceptance-cookbook/metadata.rb
@@ -495,8 +434,10 @@ files:
495
434
  - acceptance/fips/.acceptance/acceptance-cookbook/recipes/provision.rb
496
435
  - acceptance/fips/.acceptance/acceptance-cookbook/recipes/verify.rb
497
436
  - acceptance/fips/.kitchen.yml
498
- - acceptance/fips/test/integration/fips/serverspec/Gemfile
499
- - acceptance/fips/test/integration/fips/serverspec/fips_spec.rb
437
+ - acceptance/fips/test/integration/fips-integration/serverspec/Gemfile
438
+ - acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb
439
+ - acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile
440
+ - acceptance/fips/test/integration/fips-unit-functional/serverspec/fips-unit-functional_spec.rb
500
441
  - acceptance/omnitruck/.acceptance/acceptance-cookbook/.gitignore
501
442
  - acceptance/omnitruck/.acceptance/acceptance-cookbook/metadata.rb
502
443
  - acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/destroy.rb
@@ -540,7 +481,7 @@ files:
540
481
  - bin/chef-shell
541
482
  - bin/chef-solo
542
483
  - bin/knife
543
- - chef-windows.gemspec
484
+ - chef-universal-mingw32.gemspec
544
485
  - chef.gemspec
545
486
  - distro/common/html/_sources/ctl_chef_client.txt
546
487
  - distro/common/html/_sources/ctl_chef_server.txt
@@ -707,8 +648,21 @@ files:
707
648
  - distro/common/markdown/man8/chef-solr.mkd
708
649
  - distro/powershell/chef/chef.psm1
709
650
  - lib-backcompat/chef/chef_fs/file_system/acl_entry.rb
651
+ - lib-backcompat/chef/chef_fs/file_system/already_exists_error.rb
710
652
  - lib-backcompat/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb
711
653
  - lib-backcompat/chef/chef_fs/file_system/chef_server_root_dir.rb
654
+ - lib-backcompat/chef/chef_fs/file_system/cookbook_frozen_error.rb
655
+ - lib-backcompat/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb
656
+ - lib-backcompat/chef/chef_fs/file_system/file_system_error.rb
657
+ - lib-backcompat/chef/chef_fs/file_system/must_delete_recursively_error.rb
658
+ - lib-backcompat/chef/chef_fs/file_system/not_found_error.rb
659
+ - lib-backcompat/chef/chef_fs/file_system/operation_failed_error.rb
660
+ - lib-backcompat/chef/chef_fs/file_system/operation_not_allowed_error.rb
661
+ - lib-backcompat/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb
662
+ - lib-backcompat/chef/chef_fs/file_system/repository/chef_repository_file_system_client_keys_dir.rb
663
+ - lib-backcompat/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb
664
+ - lib-backcompat/chef/chef_fs/file_system/repository/chef_repository_file_system_policies_dir.rb
665
+ - lib-backcompat/chef/chef_fs/file_system/repository/file_system_root_dir.rb
712
666
  - lib/chef.rb
713
667
  - lib/chef/api_client.rb
714
668
  - lib/chef/api_client/registration.rb
@@ -751,7 +705,6 @@ files:
751
705
  - lib/chef/chef_fs/data_handler/user_data_handler.rb
752
706
  - lib/chef/chef_fs/file_pattern.rb
753
707
  - lib/chef/chef_fs/file_system.rb
754
- - lib/chef/chef_fs/file_system/already_exists_error.rb
755
708
  - lib/chef/chef_fs/file_system/base_fs_dir.rb
756
709
  - lib/chef/chef_fs/file_system/base_fs_object.rb
757
710
  - lib/chef/chef_fs/file_system/chef_server/acl_dir.rb
@@ -781,36 +734,49 @@ files:
781
734
  - lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
782
735
  - lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb
783
736
  - lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb
784
- - lib/chef/chef_fs/file_system/cookbook_frozen_error.rb
785
- - lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb
786
737
  - lib/chef/chef_fs/file_system/exceptions.rb
787
- - lib/chef/chef_fs/file_system/file_system_error.rb
788
738
  - lib/chef/chef_fs/file_system/memory/memory_dir.rb
789
739
  - lib/chef/chef_fs/file_system/memory/memory_file.rb
790
740
  - lib/chef/chef_fs/file_system/memory/memory_root.rb
791
741
  - lib/chef/chef_fs/file_system/multiplexed_dir.rb
792
- - lib/chef/chef_fs/file_system/must_delete_recursively_error.rb
793
742
  - lib/chef/chef_fs/file_system/nonexistent_fs_object.rb
794
- - lib/chef/chef_fs/file_system/not_found_error.rb
795
- - lib/chef/chef_fs/file_system/operation_failed_error.rb
796
- - lib/chef/chef_fs/file_system/operation_not_allowed_error.rb
797
- - lib/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb
798
- - lib/chef/chef_fs/file_system/repository/chef_repository_file_system_client_keys_dir.rb
743
+ - lib/chef/chef_fs/file_system/repository/acl.rb
744
+ - lib/chef/chef_fs/file_system/repository/acls_dir.rb
745
+ - lib/chef/chef_fs/file_system/repository/acls_sub_dir.rb
746
+ - lib/chef/chef_fs/file_system/repository/base_file.rb
799
747
  - lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb
800
748
  - lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb
801
749
  - lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
802
- - lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb
803
- - lib/chef/chef_fs/file_system/repository/chef_repository_file_system_policies_dir.rb
804
750
  - lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
805
751
  - lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb
752
+ - lib/chef/chef_fs/file_system/repository/client.rb
753
+ - lib/chef/chef_fs/file_system/repository/client_key.rb
754
+ - lib/chef/chef_fs/file_system/repository/client_keys_dir.rb
755
+ - lib/chef/chef_fs/file_system/repository/client_keys_sub_dir.rb
756
+ - lib/chef/chef_fs/file_system/repository/clients_dir.rb
757
+ - lib/chef/chef_fs/file_system/repository/container.rb
758
+ - lib/chef/chef_fs/file_system/repository/containers_dir.rb
806
759
  - lib/chef/chef_fs/file_system/repository/cookbook_artifacts_dir.rb
807
760
  - lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb
808
761
  - lib/chef/chef_fs/file_system/repository/data_bag.rb
809
762
  - lib/chef/chef_fs/file_system/repository/data_bag_item.rb
810
763
  - lib/chef/chef_fs/file_system/repository/data_bags_dir.rb
811
764
  - lib/chef/chef_fs/file_system/repository/directory.rb
765
+ - lib/chef/chef_fs/file_system/repository/environment.rb
766
+ - lib/chef/chef_fs/file_system/repository/environments_dir.rb
812
767
  - lib/chef/chef_fs/file_system/repository/file_system_entry.rb
813
- - lib/chef/chef_fs/file_system/repository/file_system_root_dir.rb
768
+ - lib/chef/chef_fs/file_system/repository/group.rb
769
+ - lib/chef/chef_fs/file_system/repository/groups_dir.rb
770
+ - lib/chef/chef_fs/file_system/repository/node.rb
771
+ - lib/chef/chef_fs/file_system/repository/nodes_dir.rb
772
+ - lib/chef/chef_fs/file_system/repository/policies_dir.rb
773
+ - lib/chef/chef_fs/file_system/repository/policy.rb
774
+ - lib/chef/chef_fs/file_system/repository/policy_group.rb
775
+ - lib/chef/chef_fs/file_system/repository/policy_groups_dir.rb
776
+ - lib/chef/chef_fs/file_system/repository/role.rb
777
+ - lib/chef/chef_fs/file_system/repository/roles_dir.rb
778
+ - lib/chef/chef_fs/file_system/repository/user.rb
779
+ - lib/chef/chef_fs/file_system/repository/users_dir.rb
814
780
  - lib/chef/chef_fs/file_system/repository/versioned_cookbooks_dir.rb
815
781
  - lib/chef/chef_fs/knife.rb
816
782
  - lib/chef/chef_fs/parallelizer.rb
@@ -1964,6 +1930,8 @@ files:
1964
1930
  - spec/unit/chef_fs/file_pattern_spec.rb
1965
1931
  - spec/unit/chef_fs/file_system/cookbook_subdir_spec.rb
1966
1932
  - spec/unit/chef_fs/file_system/operation_failed_error_spec.rb
1933
+ - spec/unit/chef_fs/file_system/repository/base_file_spec.rb
1934
+ - spec/unit/chef_fs/file_system/repository/directory_spec.rb
1967
1935
  - spec/unit/chef_fs/file_system_spec.rb
1968
1936
  - spec/unit/chef_fs/parallelizer.rb
1969
1937
  - spec/unit/chef_fs/path_util_spec.rb
@@ -1991,6 +1959,7 @@ files:
1991
1959
  - spec/unit/digester_spec.rb
1992
1960
  - spec/unit/dsl/audit_spec.rb
1993
1961
  - spec/unit/dsl/data_query_spec.rb
1962
+ - spec/unit/dsl/declare_resource_spec.rb
1994
1963
  - spec/unit/dsl/platform_introspection_spec.rb
1995
1964
  - spec/unit/dsl/reboot_pending_spec.rb
1996
1965
  - spec/unit/dsl/recipe_spec.rb
@@ -2416,8 +2385,17 @@ files:
2416
2385
  - spec/unit/version_constraint_spec.rb
2417
2386
  - spec/unit/win32/registry_spec.rb
2418
2387
  - spec/unit/windows_service_spec.rb
2388
+ - tasks/bin/bundle-platform
2389
+ - tasks/bin/bundle-platform.bat
2390
+ - tasks/bin/create-override-gemfile
2391
+ - tasks/bin/run_chef_tests
2392
+ - tasks/bin/run_external_test
2393
+ - tasks/bundle.rb
2394
+ - tasks/bundle_util.rb
2419
2395
  - tasks/cbgb.rb
2420
- - tasks/external_tests.rb
2396
+ - tasks/changelog.rb
2397
+ - tasks/dependencies.rb
2398
+ - tasks/gemfile_util.rb
2421
2399
  - tasks/maintainers.rb
2422
2400
  - tasks/rspec.rb
2423
2401
  homepage: http://www.chef.io