chef 12.15.19-universal-mingw32 → 12.16.42-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/VERSION +1 -1
  4. data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +3 -1
  5. data/acceptance/Gemfile.lock +14 -14
  6. data/acceptance/data-collector/test/integration/default/serverspec/default_spec.rb +3 -11
  7. data/distro/common/html/knife_bootstrap.html +1 -1
  8. data/distro/common/man/man1/README.md +2 -2
  9. data/distro/common/man/man1/knife-client.1 +1 -1
  10. data/lib/chef/application.rb +7 -15
  11. data/lib/chef/application/client.rb +2 -2
  12. data/lib/chef/application/solo.rb +1 -1
  13. data/lib/chef/chef_class.rb +1 -0
  14. data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +3 -7
  15. data/lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb +1 -1
  16. data/lib/chef/data_collector.rb +83 -9
  17. data/lib/chef/data_collector/messages.rb +2 -1
  18. data/lib/chef/dsl/core.rb +1 -1
  19. data/lib/chef/dsl/declare_resource.rb +10 -4
  20. data/lib/chef/dsl/method_missing.rb +1 -1
  21. data/lib/chef/dsl/recipe.rb +1 -1
  22. data/lib/chef/dsl/universal.rb +1 -1
  23. data/lib/chef/event_dispatch/base.rb +3 -0
  24. data/lib/chef/http.rb +3 -4
  25. data/lib/chef/knife.rb +20 -2
  26. data/lib/chef/knife/core/generic_presenter.rb +18 -4
  27. data/lib/chef/knife/node_show.rb +0 -5
  28. data/lib/chef/knife/osc_user_show.rb +0 -1
  29. data/lib/chef/knife/ssl_fetch.rb +9 -5
  30. data/lib/chef/mixin/powershell_out.rb +1 -1
  31. data/lib/chef/mixin/shell_out.rb +1 -1
  32. data/lib/chef/node.rb +1 -5
  33. data/lib/chef/node/attribute.rb +70 -98
  34. data/lib/chef/node/attribute_collections.rb +28 -19
  35. data/lib/chef/node/common_api.rb +0 -6
  36. data/lib/chef/node/immutable_collections.rb +16 -79
  37. data/lib/chef/node/mixin/deep_merge_cache.rb +61 -0
  38. data/lib/chef/node/mixin/immutablize_array.rb +67 -0
  39. data/lib/chef/node/mixin/immutablize_hash.rb +54 -0
  40. data/lib/chef/node/mixin/state_tracking.rb +93 -0
  41. data/lib/chef/property.rb +4 -4
  42. data/lib/chef/provider/cron.rb +1 -1
  43. data/lib/chef/provider/group/suse.rb +23 -4
  44. data/lib/chef/provider/package.rb +43 -5
  45. data/lib/chef/provider/package/apt.rb +20 -0
  46. data/lib/chef/provider/package/windows/exe.rb +4 -3
  47. data/lib/chef/provider/package/windows/msi.rb +4 -3
  48. data/lib/chef/provider/package/yum.rb +20 -0
  49. data/lib/chef/provider/package/zypper.rb +20 -0
  50. data/lib/chef/provider/ruby_block.rb +1 -1
  51. data/lib/chef/provider/service/upstart.rb +25 -9
  52. data/lib/chef/provider/user.rb +4 -6
  53. data/lib/chef/provider/user/dscl.rb +8 -3
  54. data/lib/chef/provider/user/solaris.rb +5 -12
  55. data/lib/chef/resource.rb +19 -0
  56. data/lib/chef/resource/file.rb +1 -1
  57. data/lib/chef/resource/package.rb +1 -1
  58. data/lib/chef/resource/scm.rb +1 -7
  59. data/lib/chef/resource/yum_repository.rb +1 -1
  60. data/lib/chef/rest.rb +1 -0
  61. data/lib/chef/run_context.rb +12 -0
  62. data/lib/chef/version.rb +1 -1
  63. data/spec/data/trusted_certs/example_no_cn.crt +36 -0
  64. data/spec/functional/resource/group_spec.rb +1 -0
  65. data/spec/functional/resource/user/useradd_spec.rb +4 -2
  66. data/spec/integration/knife/data_bag_create_spec.rb +0 -3
  67. data/spec/integration/knife/environment_show_spec.rb +24 -4
  68. data/spec/integration/knife/node_environment_set_spec.rb +4 -1
  69. data/spec/integration/recipes/accumulator_spec.rb +232 -0
  70. data/spec/integration/recipes/resource_action_spec.rb +1 -1
  71. data/spec/spec_helper.rb +2 -2
  72. data/spec/support/shared/context/client.rb +12 -3
  73. data/spec/support/shared/integration/app_server_support.rb +1 -1
  74. data/spec/support/shared/integration/knife_support.rb +4 -1
  75. data/spec/unit/data_collector/messages_spec.rb +2 -0
  76. data/spec/unit/data_collector_spec.rb +158 -21
  77. data/spec/unit/http_spec.rb +1 -1
  78. data/spec/unit/knife/core/gem_glob_loader_spec.rb +1 -1
  79. data/spec/unit/knife/core/ui_spec.rb +10 -0
  80. data/spec/unit/knife/ssl_fetch_spec.rb +38 -0
  81. data/spec/unit/knife_spec.rb +31 -0
  82. data/spec/unit/mixin/powershell_out_spec.rb +25 -1
  83. data/spec/unit/node/attribute_spec.rb +46 -1
  84. data/spec/unit/node/vivid_mash_spec.rb +27 -89
  85. data/spec/unit/node_spec.rb +134 -3
  86. data/spec/unit/provider/deploy_spec.rb +1 -1
  87. data/spec/unit/provider/group/suse_spec.rb +90 -0
  88. data/spec/unit/provider/package/apt_spec.rb +22 -0
  89. data/spec/unit/provider/package/windows/msi_spec.rb +13 -4
  90. data/spec/unit/provider/package/windows_spec.rb +3 -3
  91. data/spec/unit/provider/package/yum_spec.rb +18 -0
  92. data/spec/unit/provider/package/zypper_spec.rb +64 -0
  93. data/spec/unit/provider/package_spec.rb +58 -0
  94. data/spec/unit/provider/remote_file/content_spec.rb +1 -1
  95. data/spec/unit/provider/service/upstart_service_spec.rb +13 -6
  96. data/spec/unit/provider/user/solaris_spec.rb +36 -9
  97. data/spec/unit/provider/user_spec.rb +6 -0
  98. data/spec/unit/resource/apt_repository_spec.rb +1 -1
  99. metadata +12 -5
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: AJ Christensen (<aj@chef.io>)
4
- # Copyright:: Copyright 2009-2016, Opscode
4
+ # Copyright:: Copyright 2009-2016, Chef Software, Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,6 +26,9 @@ class Chef
26
26
  class Service
27
27
  class Upstart < Chef::Provider::Service::Simple
28
28
 
29
+ # to maintain a local state of service across restart's internal calls
30
+ attr_accessor :upstart_service_running
31
+
29
32
  provides :service, platform_family: "debian", override: true do |node|
30
33
  Chef::Platform::ServiceHelpers.service_resource_providers.include?(:upstart)
31
34
  end
@@ -110,23 +113,23 @@ class Chef
110
113
 
111
114
  begin
112
115
  if shell_out!(@new_resource.status_command).exitstatus == 0
113
- @current_resource.running true
116
+ @upstart_service_running = true
114
117
  end
115
118
  rescue
116
119
  @command_success = false
117
- @current_resource.running false
120
+ @upstart_service_running = false
118
121
  nil
119
122
  end
120
123
  else
121
124
  begin
122
125
  if upstart_goal_state == "start"
123
- @current_resource.running true
126
+ @upstart_service_running = true
124
127
  else
125
- @current_resource.running false
128
+ @upstart_service_running = false
126
129
  end
127
130
  rescue Chef::Exceptions::Exec
128
131
  @command_success = false
129
- @current_resource.running false
132
+ @upstart_service_running = false
130
133
  nil
131
134
  end
132
135
  end
@@ -153,13 +156,14 @@ class Chef
153
156
  @current_resource.enabled false
154
157
  end
155
158
 
159
+ @current_resource.running @upstart_service_running
156
160
  @current_resource
157
161
  end
158
162
 
159
163
  def start_service
160
164
  # Calling start on a service that is already started will return 1
161
165
  # Our 'goal' when we call start is to ensure the service is started
162
- if @current_resource.running
166
+ if @upstart_service_running
163
167
  Chef::Log.debug("#{@new_resource} already running, not starting")
164
168
  else
165
169
  if @new_resource.start_command
@@ -168,12 +172,14 @@ class Chef
168
172
  shell_out_with_systems_locale!("/sbin/start #{@job}")
169
173
  end
170
174
  end
175
+
176
+ @upstart_service_running = true
171
177
  end
172
178
 
173
179
  def stop_service
174
180
  # Calling stop on a service that is already stopped will return 1
175
181
  # Our 'goal' when we call stop is to ensure the service is stopped
176
- unless @current_resource.running
182
+ unless @upstart_service_running
177
183
  Chef::Log.debug("#{@new_resource} not running, not stopping")
178
184
  else
179
185
  if @new_resource.stop_command
@@ -182,6 +188,8 @@ class Chef
182
188
  shell_out_with_systems_locale!("/sbin/stop #{@job}")
183
189
  end
184
190
  end
191
+
192
+ @upstart_service_running = false
185
193
  end
186
194
 
187
195
  def restart_service
@@ -189,13 +197,19 @@ class Chef
189
197
  super
190
198
  # Upstart always provides restart functionality so we don't need to mimic it with stop/sleep/start.
191
199
  # Older versions of upstart would fail on restart if the service was currently stopped, check for that. LP:430883
200
+ # But for safe working of latest upstart job config being loaded, 'restart' can't be used as per link
201
+ # http://upstart.ubuntu.com/cookbook/#restart (it doesn't uses latest jon config from disk but retains old)
192
202
  else
193
- if @current_resource.running
194
- shell_out_with_systems_locale!("/sbin/restart #{@job}")
203
+ if @upstart_service_running
204
+ stop_service
205
+ sleep 1
206
+ start_service
195
207
  else
196
208
  start_service
197
209
  end
198
210
  end
211
+
212
+ @upstart_service_running = true
199
213
  end
200
214
 
201
215
  def reload_service
@@ -205,6 +219,8 @@ class Chef
205
219
  # upstart >= 0.6.3-4 supports reload (HUP)
206
220
  shell_out_with_systems_locale!("/sbin/reload #{@job}")
207
221
  end
222
+
223
+ @upstart_service_running = true
208
224
  end
209
225
 
210
226
  # https://bugs.launchpad.net/upstart/+bug/94065
@@ -113,15 +113,13 @@ class Chef
113
113
  # <true>:: If a change is required
114
114
  # <false>:: If the users are identical
115
115
  def compare_user
116
- changed = [ :comment, :home, :shell, :password ].select do |user_attrib|
117
- !@new_resource.send(user_attrib).nil? && @new_resource.send(user_attrib) != @current_resource.send(user_attrib)
118
- end
116
+ return true if !@new_resource.home.nil? && Pathname.new(@new_resource.home).cleanpath != Pathname.new(@current_resource.home).cleanpath
119
117
 
120
- changed += [ :uid, :gid ].select do |user_attrib|
121
- !@new_resource.send(user_attrib).nil? && @new_resource.send(user_attrib).to_s != @current_resource.send(user_attrib).to_s
118
+ [ :comment, :shell, :password, :uid, :gid ].each do |user_attrib|
119
+ return true if !@new_resource.send(user_attrib).nil? && @new_resource.send(user_attrib).to_s != @current_resource.send(user_attrib).to_s
122
120
  end
123
121
 
124
- changed.any?
122
+ false
125
123
  end
126
124
 
127
125
  def action_create
@@ -51,6 +51,11 @@ class Chef
51
51
  provides :dscl_user
52
52
  provides :user, os: "darwin"
53
53
 
54
+ # Just-in-case a recipe calls the user dscl provider without specifying
55
+ # a gid property. Avoids chown issues in move_home when the manage_home
56
+ # property is in use. #5393
57
+ STAFF_GROUP_ID = 20
58
+
54
59
  def define_resource_requirements
55
60
  super
56
61
 
@@ -264,12 +269,12 @@ user password using shadow hash.")
264
269
  #
265
270
  # Sets the group id for the user using dscl. Fails if a group doesn't
266
271
  # exist on the system with given group id. If `gid` is not specified, it
267
- # sets a default Mac user group "staff", with id 20.
272
+ # sets a default Mac user group "staff", with id 20 using the CONSTANT
268
273
  #
269
274
  def dscl_set_gid
270
275
  if new_resource.gid.nil?
271
276
  # XXX: mutates the new resource
272
- new_resource.gid(20)
277
+ new_resource.gid(STAFF_GROUP_ID)
273
278
  elsif !new_resource.gid.to_s.match(/^\d+$/)
274
279
  begin
275
280
  possible_gid = run_dscl("read /Groups/#{new_resource.gid} PrimaryGroupID").split(" ").last
@@ -329,7 +334,7 @@ user password using shadow hash.")
329
334
 
330
335
  def move_home
331
336
  Chef::Log.debug("#{new_resource} moving #{self} home from #{current_resource.home} to #{new_resource.home}")
332
-
337
+ new_resource.gid(STAFF_GROUP_ID) if new_resource.gid.nil?
333
338
  src = current_resource.home
334
339
  FileUtils.mkdir_p(new_resource.home)
335
340
  files = ::Dir.glob("#{Chef::Util::PathHelper.escape_glob_dir(src)}/*", ::File::FNM_DOTMATCH) - ["#{src}/.", "#{src}/.."]
@@ -46,21 +46,14 @@ class Chef
46
46
  end
47
47
 
48
48
  def check_lock
49
- shadow_line = shell_out!("getent", "shadow", new_resource.username).stdout.strip rescue nil
49
+ user = IO.read(@password_file).match(/^#{Regexp.escape(@new_resource.username)}:([^:]*):/)
50
50
 
51
- # if the command fails we return nil, this can happen if the user
52
- # in question doesn't exist
53
- return nil if shadow_line.nil?
51
+ # If we're in whyrun mode, and the user is not created, we assume it will be
52
+ return false if whyrun_mode? && user.nil?
54
53
 
55
- # convert "dave:NP:16507::::::\n" to "NP"
56
- fields = shadow_line.split(":")
54
+ raise Chef::Exceptions::User, "Cannot determine if #{@new_resource} is locked!" if user.nil?
57
55
 
58
- # '*LK*...' and 'LK' are both considered locked,
59
- # so look for LK at the beginning of the shadow entry
60
- # optionally surrounded by '*'
61
- @locked = !!fields[1].match(/^\*?LK\*?/)
62
-
63
- @locked
56
+ @locked = user[1].start_with?("*LK*")
64
57
  end
65
58
 
66
59
  def lock_user
@@ -180,6 +180,25 @@ class Chef
180
180
  # Alias for normal assigment syntax.
181
181
  alias_method :action=, :action
182
182
 
183
+ #
184
+ # Force a delayed notification into this resource's run_context.
185
+ #
186
+ # This should most likely be paired with action :nothing
187
+ #
188
+ # @param arg [Array[Symbol], Symbol] A list of actions (e.g. `:create`)
189
+ #
190
+ def delayed_action(arg)
191
+ arg = Array(arg).map(&:to_sym)
192
+ arg.map do |action|
193
+ validate(
194
+ { action: action },
195
+ { action: { kind_of: Symbol, equal_to: allowed_actions } }
196
+ )
197
+ # the resource effectively sends a delayed notification to itself
198
+ run_context.add_delayed_action(Notification.new(self, action, self))
199
+ end
200
+ end
201
+
183
202
  #
184
203
  # Sets up a notification that will run a particular action on another resource
185
204
  # if and when *this* resource is updated by an action.
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Seth Chisamore (<schisamo@chef.io>)
4
- # Copyright:: Copyright 2008-2016, 2011-2015 Chef Software, Inc.
4
+ # Copyright:: Copyright 2008-2016 Chef Software, Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,7 +25,7 @@ class Chef
25
25
  resource_name :package
26
26
 
27
27
  default_action :install
28
- allowed_actions :install, :upgrade, :remove, :purge, :reconfig
28
+ allowed_actions :install, :upgrade, :remove, :purge, :reconfig, :lock, :unlock
29
29
 
30
30
  def initialize(name, *args)
31
31
  # We capture name here, before it gets coerced to name
@@ -89,13 +89,7 @@ class Chef
89
89
  )
90
90
  end
91
91
 
92
- def svn_password(arg = nil)
93
- set_or_return(
94
- :svn_password,
95
- arg,
96
- :kind_of => String
97
- )
98
- end
92
+ property :svn_password, String, sensitive: true, desired_state: false
99
93
 
100
94
  def svn_arguments(arg = nil)
101
95
  @svn_arguments, arg = nil, nil if arg == false
@@ -57,7 +57,7 @@ class Chef
57
57
  property :password, String, regex: /.*/
58
58
  property :repo_gpgcheck, [TrueClass, FalseClass]
59
59
  property :report_instanceid, [TrueClass, FalseClass]
60
- property :repositoryid, String, regex: /.*/, name_attribute: true
60
+ property :repositoryid, String, regex: /.*/, name_property: true
61
61
  property :sensitive, [TrueClass, FalseClass], default: false
62
62
  property :skip_if_unavailable, [TrueClass, FalseClass]
63
63
  property :source, String, regex: /.*/
@@ -37,6 +37,7 @@ require "chef/config"
37
37
  require "chef/exceptions"
38
38
  require "chef/platform/query_helpers"
39
39
  require "chef/http/remote_request_id"
40
+ require "chef/chef_class"
40
41
 
41
42
  class Chef
42
43
 
@@ -84,6 +84,17 @@ class Chef
84
84
  #
85
85
  attr_reader :parent_run_context
86
86
 
87
+ #
88
+ # The root run context.
89
+ #
90
+ # @return [Chef::RunContext] The root run context.
91
+ #
92
+ def root_run_context
93
+ rc = self
94
+ rc = rc.parent_run_context until rc.parent_run_context.nil?
95
+ rc
96
+ end
97
+
87
98
  #
88
99
  # The collection of resources intended to be converged (and able to be
89
100
  # notified).
@@ -653,6 +664,7 @@ ERROR_MESSAGE
653
664
  notifies_immediately
654
665
  notifies_delayed
655
666
  parent_run_context
667
+ root_run_context
656
668
  resource_collection
657
669
  resource_collection=
658
670
  }.map { |x| x.to_sym }
@@ -21,7 +21,7 @@
21
21
 
22
22
  class Chef
23
23
  CHEF_ROOT = File.expand_path("../..", __FILE__)
24
- VERSION = "12.15.19"
24
+ VERSION = "12.16.42"
25
25
  end
26
26
 
27
27
  #
@@ -0,0 +1,36 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIGPzCCBCegAw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+ xCBlXAdYxD0n0/bruUYNoXBeMhLp+WKSAQvTlVIyqoNQCo1OBBzBVNg9otl3jw5d
34
+ 1QOhodRqmS5UQAJptuXtk8WN8OZqMCCeogIfdpa5tJG+/fxFML9EvqedS4c05Wf/
35
+ oYdVLVWSjyoA2l4Xb4LdexAgCg==
36
+ -----END CERTIFICATE-----
@@ -425,6 +425,7 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" end
425
425
  end
426
426
 
427
427
  it "does not raise an error on manage" do
428
+ allow(Etc).to receive(:getpwnam).and_return(double("User"))
428
429
  expect { group_resource.run_action(:manage) }.not_to raise_error
429
430
  end
430
431
  end
@@ -637,8 +637,10 @@ describe Chef::Provider::User::Useradd, metadata do
637
637
  context "and has no password" do
638
638
 
639
639
  # TODO: platform_family should be setup in spec_helper w/ tags
640
- if %w{suse opensuse}.include?(OHAI_SYSTEM["platform_family"])
641
- # suse gets this right:
640
+ if %w{opensuse}.include?(OHAI_SYSTEM["platform_family"]) ||
641
+ (%w{suse}.include?(OHAI_SYSTEM["platform_family"]) &&
642
+ OHAI_SYSTEM["platform_version"].to_f < 12.1)
643
+ # suse 11.x gets this right:
642
644
  it "errors out trying to unlock the user" do
643
645
  expect(@error).to be_a(Mixlib::ShellOut::ShellCommandFailed)
644
646
  expect(@error.message).to include("Cannot unlock the password")
@@ -34,12 +34,10 @@ describe "knife data bag create", :workstation do
34
34
  end
35
35
 
36
36
  it "creates a new data bag and item" do
37
- pending "Deprecation warning must get fixed"
38
37
  knife("data bag create foo bar").should_succeed stdout: out, stderr: err
39
38
  end
40
39
 
41
40
  it "adds a new item to an existing bag" do
42
- pending "Deprecation warning must get fixed"
43
41
  knife("data bag create foo").should_succeed stderr: err
44
42
  knife("data bag create foo bar").should_succeed stdout: out, stderr: exists
45
43
  end
@@ -50,7 +48,6 @@ describe "knife data bag create", :workstation do
50
48
  end
51
49
 
52
50
  it "fails to add an existing item" do
53
- pending "Deprecation warning must get fixed"
54
51
  knife("data bag create foo bar").should_succeed stdout: out, stderr: err
55
52
  expect { knife("data bag create foo bar") }.to raise_error(Net::HTTPServerException)
56
53
  end
@@ -26,7 +26,7 @@ describe "knife environment show", :workstation do
26
26
  when_the_chef_server "has some environments" do
27
27
  before do
28
28
  environment "b", {
29
- "default_attributes" => { "foo" => "bar" },
29
+ "default_attributes" => { "foo" => "bar", "baz" => { "raz.my" => "mataz" } },
30
30
  }
31
31
  end
32
32
 
@@ -36,6 +36,8 @@ describe "knife environment show", :workstation do
36
36
  chef_type: environment
37
37
  cookbook_versions:
38
38
  default_attributes:
39
+ baz:
40
+ raz.my: mataz
39
41
  foo: bar
40
42
  description:
41
43
  json_class: Chef::Environment
@@ -46,11 +48,29 @@ EOM
46
48
  # rubocop:enable Style/TrailingWhitespace
47
49
 
48
50
  it "shows the requested attribute of an environment" do
49
- pending "KnifeSupport doesn't appear to pass this through correctly"
50
- knife("environment show b -a foo").should_succeed <<EOM
51
+ knife("environment show b -a default_attributes").should_succeed <<EOM
51
52
  b:
52
- foo: bar
53
+ default_attributes:
54
+ baz:
55
+ raz.my: mataz
56
+ foo: bar
53
57
  EOM
54
58
  end
59
+
60
+ it "shows the requested nested attribute of an environment" do
61
+ knife("environment show b -a default_attributes.baz").should_succeed <<EON
62
+ b:
63
+ default_attributes.baz:
64
+ raz.my: mataz
65
+ EON
66
+ end
67
+
68
+ it "shows the requested attribute of an environment with custom field separator" do
69
+ knife("environment show b -S: -a default_attributes:baz").should_succeed <<EOT
70
+ b:
71
+ default_attributes:baz:
72
+ raz.my: mataz
73
+ EOT
74
+ end
55
75
  end
56
76
  end