chef 15.7.32 → 15.8.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/chef-universal-mingw32.gemspec +1 -1
  3. data/lib/chef/dsl/declare_resource.rb +9 -9
  4. data/lib/chef/knife/client_key_create.rb +4 -1
  5. data/lib/chef/knife/client_key_delete.rb +4 -1
  6. data/lib/chef/knife/client_key_edit.rb +4 -1
  7. data/lib/chef/knife/client_key_list.rb +4 -1
  8. data/lib/chef/knife/client_key_show.rb +4 -1
  9. data/lib/chef/knife/config_list_profiles.rb +4 -1
  10. data/lib/chef/knife/config_use_profile.rb +4 -2
  11. data/lib/chef/knife/configure.rb +1 -1
  12. data/lib/chef/knife/cookbook_upload.rb +3 -6
  13. data/lib/chef/knife/data_bag_from_file.rb +1 -1
  14. data/lib/chef/knife/exec.rb +4 -1
  15. data/lib/chef/knife/raw.rb +0 -1
  16. data/lib/chef/knife/rehash.rb +4 -1
  17. data/lib/chef/knife/search.rb +1 -1
  18. data/lib/chef/knife/ssh.rb +3 -3
  19. data/lib/chef/knife/ssl_check.rb +1 -1
  20. data/lib/chef/knife/ssl_fetch.rb +1 -1
  21. data/lib/chef/knife/supermarket_install.rb +1 -1
  22. data/lib/chef/knife/user_key_create.rb +4 -1
  23. data/lib/chef/knife/user_key_delete.rb +4 -1
  24. data/lib/chef/knife/user_key_edit.rb +4 -1
  25. data/lib/chef/knife/user_key_list.rb +4 -1
  26. data/lib/chef/knife/user_key_show.rb +4 -1
  27. data/lib/chef/node/attribute.rb +3 -1
  28. data/lib/chef/node/common_api.rb +3 -1
  29. data/lib/chef/provider/ifconfig.rb +13 -4
  30. data/lib/chef/provider/user/mac.rb +53 -9
  31. data/lib/chef/resource/notify_group.rb +70 -0
  32. data/lib/chef/resource/sysctl.rb +26 -2
  33. data/lib/chef/resource/user/mac_user.rb +4 -1
  34. data/lib/chef/resource/windows_task.rb +2 -1
  35. data/lib/chef/resources.rb +2 -1
  36. data/lib/chef/search/query.rb +1 -1
  37. data/lib/chef/shell.rb +4 -5
  38. data/lib/chef/shell/ext.rb +3 -5
  39. data/lib/chef/version.rb +1 -1
  40. data/lib/chef/win32/system.rb +0 -0
  41. data/spec/unit/cookbook_uploader_spec.rb +1 -0
  42. data/spec/unit/knife/cookbook_upload_spec.rb +2 -2
  43. data/spec/unit/provider/ifconfig_spec.rb +43 -14
  44. data/spec/unit/resource/notify_group_spec.rb +34 -0
  45. data/spec/unit/resource/sysctl_spec.rb +23 -1
  46. data/spec/unit/search/query_spec.rb +8 -1
  47. metadata +8 -6
@@ -63,7 +63,7 @@ class Chef
63
63
 
64
64
  args_h = hashify_args(*args)
65
65
  if args_h[:fuzz]
66
- if type == :node
66
+ if type.to_sym == :node
67
67
  query = fuzzify_node_query(query)
68
68
  end
69
69
  # FIXME: can i haz proper ruby-2.x named parameters someday plz?
@@ -159,11 +159,10 @@ module Shell
159
159
 
160
160
  puts "run `help' for help, `exit' or ^D to quit."
161
161
  puts
162
- puts "Ohai2u#{greeting}!"
163
162
  end
164
163
 
165
164
  def self.greeting
166
- " #{Etc.getlogin}@#{Shell.session.node["fqdn"]}"
165
+ "#{Etc.getlogin}@#{Shell.session.node["fqdn"]}"
167
166
  rescue NameError, ArgumentError
168
167
  ""
169
168
  end
@@ -241,7 +240,7 @@ module Shell
241
240
  option :standalone,
242
241
  short: "-a",
243
242
  long: "--standalone",
244
- description: "standalone session",
243
+ description: "Standalone session",
245
244
  default: true,
246
245
  boolean: true
247
246
 
@@ -255,7 +254,7 @@ module Shell
255
254
  option :client,
256
255
  short: "-z",
257
256
  long: "--client",
258
- description: "#{Chef::Dist::CLIENT} session",
257
+ description: "#{Chef::Dist::PRODUCT} session",
259
258
  boolean: true
260
259
 
261
260
  option :solo_legacy_shell,
@@ -273,7 +272,7 @@ module Shell
273
272
  option :chef_server_url,
274
273
  short: "-S CHEFSERVERURL",
275
274
  long: "--server CHEFSERVERURL",
276
- description: "The #{Chef::Dist::PRODUCT} server URL",
275
+ description: "The #{Chef::Dist::SERVER_PRODUCT} URL",
277
276
  proc: nil
278
277
 
279
278
  option :version,
@@ -204,16 +204,14 @@ module Shell
204
204
  else
205
205
  puts help_banner
206
206
  end
207
- :ucanhaz_halp
207
+ :help
208
208
  end
209
209
  alias :halp :help
210
210
 
211
211
  desc "prints information about #{Chef::Dist::PRODUCT}"
212
212
  def version
213
- puts "This is the #{Chef::Dist::SHELL}.\n" +
214
- " #{Chef::Dist::PRODUCT} Version: #{::Chef::VERSION}\n" +
215
- " #{Chef::Dist::WEBSITE}\n" +
216
- " https://docs.chef.io/"
213
+ puts "Welcome to the #{Chef::Dist::SHELL} #{::Chef::VERSION}\n" +
214
+ "For usage see https://docs.chef.io/chef_shell.html"
217
215
  :ucanhaz_automation
218
216
  end
219
217
  alias :shell :version
@@ -23,7 +23,7 @@ require_relative "version_string"
23
23
 
24
24
  class Chef
25
25
  CHEF_ROOT = File.expand_path("../..", __FILE__)
26
- VERSION = Chef::VersionString.new("15.7.32")
26
+ VERSION = Chef::VersionString.new("15.8.23")
27
27
  end
28
28
 
29
29
  #
File without changes
@@ -17,6 +17,7 @@
17
17
  #
18
18
 
19
19
  require "spec_helper"
20
+ require_relative "../../lib/chef/cookbook_uploader"
20
21
 
21
22
  describe Chef::CookbookUploader do
22
23
 
@@ -325,7 +325,7 @@ describe Chef::Knife::CookbookUpload do
325
325
  it "should warn users that no cookbooks exist" do
326
326
  knife.config[:cookbook_path] = ["/chef-repo/cookbooks", "/home/user/cookbooks"]
327
327
  expect(knife.ui).to receive(:warn).with(
328
- /Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path].join(', ')}\. Use --cookbook-path to specify the desired path\./
328
+ /Could not find any cookbooks in your cookbook path: '#{knife.config[:cookbook_path].join(', ')}'\. Use --cookbook-path to specify the desired path\./
329
329
  )
330
330
  knife.run
331
331
  end
@@ -335,7 +335,7 @@ describe Chef::Knife::CookbookUpload do
335
335
  it "should warn users that no cookbooks exist" do
336
336
  knife.config[:cookbook_path] = "/chef-repo/cookbooks"
337
337
  expect(knife.ui).to receive(:warn).with(
338
- /Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path]}\. Use --cookbook-path to specify the desired path\./
338
+ /Could not find any cookbooks in your cookbook path: '#{knife.config[:cookbook_path]}'\. Use --cookbook-path to specify the desired path\./
339
339
  )
340
340
  knife.run
341
341
  end
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Prajakta Purohit (prajakta@chef.io)
3
- # Copyright:: Copyright 2008-2018, Chef Software Inc.
3
+ # Copyright:: Copyright 2008-2020, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -46,19 +46,48 @@ describe Chef::Provider::Ifconfig do
46
46
  ifconfig 1.42 (2001-04-13)
47
47
  EOS
48
48
 
49
- before do
50
- ifconfig = double(stdout: "", exitstatus: 1)
51
- allow(@provider).to receive(:shell_out_compacted).and_return(ifconfig)
52
- ifconfig_version = double(stdout: "", stderr: net_tools_version, exitstatus: 4)
53
- allow(@provider).to receive(:shell_out_compacted).with("ifconfig", "--version").and_return(ifconfig_version)
54
- @provider.load_current_resource
55
- end
56
- it "should track state of ifconfig failure" do
57
- expect(@provider.instance_variable_get("@status").exitstatus).not_to eq(0)
58
- end
59
- it "should thrown an exception when ifconfig fails" do
60
- @provider.define_resource_requirements
61
- expect { @provider.process_resource_requirements }.to raise_error Chef::Exceptions::Ifconfig
49
+ let(:net_tools_version2) { StringIO.new <<~EOS }
50
+ net-tools 2.10-alpha
51
+ EOS
52
+
53
+ context "when ifconfig returns its version on stdout" do
54
+ before do
55
+ ifconfig = double(stdout: "", exitstatus: 1)
56
+ allow(@provider).to receive(:shell_out_compacted).and_return(ifconfig)
57
+ ifconfig_version = double(stdout: net_tools_version2, stderr: "", exitstatus: 4)
58
+ allow(@provider).to receive(:shell_out_compacted).with("ifconfig", "--version").and_return(ifconfig_version)
59
+ @provider.load_current_resource
60
+ end
61
+ it "should track state of ifconfig failure" do
62
+ expect(@provider.instance_variable_get("@status").exitstatus).not_to eq(0)
63
+ end
64
+ it "should thrown an exception when ifconfig fails" do
65
+ @provider.define_resource_requirements
66
+ expect { @provider.process_resource_requirements }.to raise_error Chef::Exceptions::Ifconfig
67
+ end
68
+ it "should grab the correct major.minor version of net-tools" do
69
+ expect(@provider.ifconfig_version).to eql("2.10")
70
+ end
71
+ end
72
+
73
+ context "when ifconfig returns its version on stderr" do
74
+ before do
75
+ ifconfig = double(stdout: "", exitstatus: 1)
76
+ allow(@provider).to receive(:shell_out_compacted).and_return(ifconfig)
77
+ ifconfig_version = double(stdout: "", stderr: net_tools_version, exitstatus: 4)
78
+ allow(@provider).to receive(:shell_out_compacted).with("ifconfig", "--version").and_return(ifconfig_version)
79
+ @provider.load_current_resource
80
+ end
81
+ it "should track state of ifconfig failure" do
82
+ expect(@provider.instance_variable_get("@status").exitstatus).not_to eq(0)
83
+ end
84
+ it "should thrown an exception when ifconfig fails" do
85
+ @provider.define_resource_requirements
86
+ expect { @provider.process_resource_requirements }.to raise_error Chef::Exceptions::Ifconfig
87
+ end
88
+ it "should grab the correct major.minor version of net-tools" do
89
+ expect(@provider.ifconfig_version).to eql("1.60")
90
+ end
62
91
  end
63
92
  end
64
93
  describe Chef::Provider::Ifconfig, "action_add" do
@@ -0,0 +1,34 @@
1
+ #
2
+ # Copyright:: 2019-2020, Chef Software Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require "spec_helper"
19
+
20
+ describe Chef::Resource::NotifyGroup do
21
+ let(:node) { Chef::Node.new }
22
+ let(:events) { Chef::EventDispatch::Dispatcher.new }
23
+ let(:run_context) { Chef::RunContext.new(node, {}, events) }
24
+ let(:resource) { Chef::Resource::NotifyGroup.new("whatever", run_context) }
25
+
26
+ it "sets the default action as :run" do
27
+ expect(resource.action).to eql([:nothing])
28
+ end
29
+
30
+ it "is always updated" do
31
+ resource.run_action(:run)
32
+ expect(resource.updated_by_last_action?).to be true
33
+ end
34
+ end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright 2018, Chef Software, Inc.
2
+ # Copyright:: Copyright 2018-2020, 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");
@@ -19,6 +19,7 @@ require "spec_helper"
19
19
 
20
20
  describe Chef::Resource::Sysctl do
21
21
  let(:resource) { Chef::Resource::Sysctl.new("fakey_fakerton") }
22
+ let(:provider) { resource.provider_for_action(:create) }
22
23
 
23
24
  it "sets resource name as :sysctl" do
24
25
  expect(resource.resource_name).to eql(:sysctl)
@@ -51,4 +52,25 @@ describe Chef::Resource::Sysctl do
51
52
  resource.value 1.1
52
53
  expect(resource.value).to eql("1.1")
53
54
  end
55
+
56
+ context "#contruct_sysctl_content" do
57
+ before do
58
+ resource.key("foo")
59
+ resource.value("bar")
60
+ end
61
+
62
+ context "when comment is a String" do
63
+ it "Returns content for use with a file resource" do
64
+ resource.comment("This sets foo / bar on our system")
65
+ expect(provider.contruct_sysctl_content).to eql("# This sets foo / bar on our system\nfoo = bar")
66
+ end
67
+ end
68
+
69
+ context "when comment is an Array" do
70
+ it "Returns content for use with a file resource" do
71
+ resource.comment(["This sets foo / bar on our system", "We need for baz"])
72
+ expect(provider.contruct_sysctl_content).to eql("# This sets foo / bar on our system\n# We need for baz\nfoo = bar")
73
+ end
74
+ end
75
+ end
54
76
  end
@@ -233,13 +233,20 @@ describe Chef::Search::Query do
233
233
  end
234
234
  end
235
235
 
236
- it "fuzzifies node searches when fuzz is set" do
236
+ it "fuzzifies node searches when fuzz is set and type is a symbol" do
237
237
  expect(rest).to receive(:get).with(
238
238
  "search/node?q=tags:*free.messi*%20OR%20roles:*free.messi*%20OR%20fqdn:*free.messi*%20OR%20addresses:*free.messi*%20OR%20policy_name:*free.messi*%20OR%20policy_group:*free.messi*&start=0&rows=#{default_rows}"
239
239
  ).and_return(response)
240
240
  query.search(:node, "free.messi", fuzz: true)
241
241
  end
242
242
 
243
+ it "fuzzifies node searches when fuzz is set and type is a string" do
244
+ expect(rest).to receive(:get).with(
245
+ "search/node?q=tags:*free.messi*%20OR%20roles:*free.messi*%20OR%20fqdn:*free.messi*%20OR%20addresses:*free.messi*%20OR%20policy_name:*free.messi*%20OR%20policy_group:*free.messi*&start=0&rows=#{default_rows}"
246
+ ).and_return(response)
247
+ query.search("node", "free.messi", fuzz: true)
248
+ end
249
+
243
250
  it "does not fuzzify node searches when fuzz is not set" do
244
251
  expect(rest).to receive(:get).with(
245
252
  "search/node?q=free.messi&start=0&rows=#{default_rows}"
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: 15.7.32
4
+ version: 15.8.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-27 00:00:00.000000000 Z
11
+ date: 2020-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 15.7.32
19
+ version: 15.8.23
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: 15.7.32
26
+ version: 15.8.23
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef-utils
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 15.7.32
33
+ version: 15.8.23
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 15.7.32
40
+ version: 15.8.23
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: train-core
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -1217,6 +1217,7 @@ files:
1217
1217
  - lib/chef/resource/mdadm.rb
1218
1218
  - lib/chef/resource/mount.rb
1219
1219
  - lib/chef/resource/msu_package.rb
1220
+ - lib/chef/resource/notify_group.rb
1220
1221
  - lib/chef/resource/ohai.rb
1221
1222
  - lib/chef/resource/ohai_hint.rb
1222
1223
  - lib/chef/resource/openbsd_package.rb
@@ -2472,6 +2473,7 @@ files:
2472
2473
  - spec/unit/resource/mdadm_spec.rb
2473
2474
  - spec/unit/resource/mount_spec.rb
2474
2475
  - spec/unit/resource/msu_package_spec.rb
2476
+ - spec/unit/resource/notify_group_spec.rb
2475
2477
  - spec/unit/resource/ohai_hint_spec.rb
2476
2478
  - spec/unit/resource/ohai_spec.rb
2477
2479
  - spec/unit/resource/openbsd_package_spec.rb