cheffish 14.0.1 → 14.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +20 -1
  3. data/Rakefile +27 -32
  4. data/cheffish.gemspec +4 -4
  5. data/lib/chef/resource/chef_acl.rb +4 -4
  6. data/lib/chef/resource/chef_data_bag_item.rb +4 -4
  7. data/lib/chef/resource/chef_mirror.rb +10 -10
  8. data/lib/chef/resource/chef_organization.rb +2 -2
  9. data/lib/chef/resource/chef_resolved_cookbooks.rb +7 -7
  10. data/lib/chef/resource/chef_user.rb +3 -3
  11. data/lib/chef/resource/private_key.rb +3 -3
  12. data/lib/chef/resource/public_key.rb +2 -2
  13. data/lib/cheffish.rb +7 -7
  14. data/lib/cheffish/base_resource.rb +1 -1
  15. data/lib/cheffish/basic_chef_client.rb +1 -2
  16. data/lib/cheffish/chef_actor_base.rb +6 -6
  17. data/lib/cheffish/chef_run.rb +2 -2
  18. data/lib/cheffish/key_formatter.rb +1 -1
  19. data/lib/cheffish/merged_config.rb +1 -1
  20. data/lib/cheffish/node_properties.rb +1 -1
  21. data/lib/cheffish/recipe_dsl.rb +2 -2
  22. data/lib/cheffish/rspec/chef_run_support.rb +3 -3
  23. data/lib/cheffish/rspec/matchers/have_updated.rb +2 -2
  24. data/lib/cheffish/version.rb +1 -1
  25. data/spec/functional/fingerprint_spec.rb +27 -27
  26. data/spec/functional/merged_config_spec.rb +9 -9
  27. data/spec/functional/server_api_spec.rb +1 -1
  28. data/spec/integration/chef_acl_spec.rb +16 -18
  29. data/spec/integration/chef_client_spec.rb +3 -3
  30. data/spec/integration/chef_mirror_spec.rb +16 -16
  31. data/spec/integration/chef_node_spec.rb +4 -4
  32. data/spec/integration/chef_role_spec.rb +2 -2
  33. data/spec/integration/chef_user_spec.rb +3 -3
  34. data/spec/integration/private_key_spec.rb +2 -2
  35. data/spec/integration/recipe_dsl_spec.rb +2 -2
  36. data/spec/support/key_support.rb +4 -4
  37. data/spec/support/spec_support.rb +1 -1
  38. data/spec/unit/get_private_key_spec.rb +6 -6
  39. metadata +6 -8
  40. data/README.md +0 -120
@@ -34,8 +34,8 @@ module Cheffish
34
34
  def client
35
35
  @client ||= begin
36
36
  chef_config = self.chef_config.dup
37
- chef_config[:log_level] ||= :debug if !chef_config.has_key?(:log_level)
38
- chef_config[:verbose_logging] = false if !chef_config.has_key?(:verbose_logging)
37
+ chef_config[:log_level] ||= :debug if !chef_config.key?(:log_level)
38
+ chef_config[:verbose_logging] = false if !chef_config.key?(:verbose_logging)
39
39
  chef_config[:stdout] = StringIOTee.new(chef_config[:stdout])
40
40
  chef_config[:stderr] = StringIOTee.new(chef_config[:stderr])
41
41
  chef_config[:log_location] = StringIOTee.new(chef_config[:log_location])
@@ -50,7 +50,7 @@ module Cheffish
50
50
  # Put : between every pair of hexes
51
51
  hexes.scan(/../).join(":")
52
52
  when :rfc4716md5fingerprint
53
- type, base64_data, etc = encode_openssh_key(key).split
53
+ _type, base64_data, _etc = encode_openssh_key(key).split
54
54
  data = Base64.decode64(base64_data)
55
55
  hexes = Digest::MD5.hexdigest(data)
56
56
  hexes.scan(/../).join(":")
@@ -57,7 +57,7 @@ module Cheffish
57
57
  end
58
58
 
59
59
  def key?(name)
60
- configs.any? { |config| config.has_key?(name) }
60
+ configs.any? { |config| config.key?(name) }
61
61
  end
62
62
 
63
63
  alias_method :has_key?, :key?
@@ -65,7 +65,7 @@ module Cheffish
65
65
  attribute("tags")
66
66
  else
67
67
  tags = tags[0] if tags.size == 1 && tags[0].kind_of?(Array)
68
- attribute "tags", tags.map { |tag| tag.to_s }
68
+ attribute("tags", tags.map { |tag| tag.to_s })
69
69
  end
70
70
  end
71
71
 
@@ -41,7 +41,7 @@ class Chef
41
41
  end
42
42
 
43
43
  def with_chef_server(server_url, options = {}, &block)
44
- run_context.cheffish.with_chef_server({ :chef_server_url => server_url, :options => options }, &block)
44
+ run_context.cheffish.with_chef_server({ chef_server_url: server_url, options: options }, &block)
45
45
  end
46
46
 
47
47
  def with_chef_local_server(options, &block)
@@ -119,7 +119,7 @@ class Chef
119
119
  Chef::Client.when_run_starts do |run_status|
120
120
  # Pulling on cheffish_run_data makes it initialize right now
121
121
  run_status.node.run_state[:chef_config] = config = Cheffish.profiled_config(Chef::Config)
122
- run_status.node.run_state[:cheffish] = run_data = Cheffish::ChefRunData.new(config)
122
+ run_status.node.run_state[:cheffish] = Cheffish::ChefRunData.new(config)
123
123
  run_status.events.register(Cheffish::ChefRunListener.new(run_status.node))
124
124
  end
125
125
 
@@ -20,7 +20,7 @@ module Cheffish
20
20
 
21
21
  def when_the_chef_12_server(*args, **options, &block)
22
22
  if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
23
- when_the_chef_server(*args, :osc_compat => false, :single_org => false, **options, &block)
23
+ when_the_chef_server(*args, osc_compat: false, single_org: false, **options, &block)
24
24
  end
25
25
  end
26
26
 
@@ -60,9 +60,9 @@ module Cheffish
60
60
  def recipe(str = nil, file = nil, line = nil, &recipe)
61
61
  if !recipe
62
62
  if file && line
63
- recipe = proc { eval(str, nil, file, line) }
63
+ recipe = proc { eval(str, nil, file, line) } # rubocop:disable Security/Eval
64
64
  else
65
- recipe = proc { eval(str) }
65
+ recipe = proc { eval(str) } # rubocop:disable Security/Eval
66
66
  end
67
67
  end
68
68
  RecipeRunWrapper.new(chef_config, &recipe)
@@ -4,8 +4,8 @@ RSpec::Matchers.define :have_updated do |resource_name, *expected_actions|
4
4
  match do |recipe|
5
5
  @recipe = recipe
6
6
  actual = @recipe.event_sink.events
7
- actual_actions = actual.select { |event, resource, action| event == :resource_updated && resource.to_s == resource_name }.
8
- map { |event, resource, action| action }
7
+ actual_actions = actual.select { |event, resource, action| event == :resource_updated && resource.to_s == resource_name }
8
+ .map { |event, resource, action| action }
9
9
  expect(actual_actions).to eq(expected_actions)
10
10
  end
11
11
 
@@ -1,3 +1,3 @@
1
1
  module Cheffish
2
- VERSION = "14.0.1"
2
+ VERSION = "14.0.4".freeze
3
3
  end
@@ -5,41 +5,41 @@ describe "Cheffish fingerprint key formatter" do
5
5
 
6
6
  # Sample key: 0x9a6fa4c43b328c3d04c1fbc0498539218b6728e41cd35f6d27d491ef705f0b2083dc1ac977da19f54ba82b044773f20667e9627c543abb3b41b6eb9e4318ca3c68f487bbd0f1c9eea9a3101b7d1d180983c5440ac4183e78e9e256fa687d8aac63b21617a4b02b35bf5e307a3b76961a16cd8493e923536b34cc2b2da8d45220d57ef2243b081b555b84f1da0ade0e896c2aa96911b41430b59eaf75dbffb7eaa7c5b3a686f2d47a24e3b7f1acb0844f84a2fedc63660ae366b800cd9448093d6b1d96503ebb7807b48257e16c3d8a7c9a8cc5dd63116aa673bd9e09754de09358486e743e34c6a3642eeb64b2208efc96df39151572557a75638bd059c21a55 = 0xd6e92677d4e1d2aa6d14f87b5f49ee6916c6b92411536254fae4a21e82eebb0a40600247c701c1c938b21ca9f25b7b330c35fded57b4de3a951e83329a80bdbf2ba138fe2f190bffce43967b5fa93b179367bcd15cb1db7f9e3ab62caca95dc9489b62bc0a10b53841b932455a43409f96eed90dc80abc8cce5593ead8f0a26d * 0xb7f68cd427045788d5e315375f71d3a416784ec2597776a60ed77c821294d9bd66e96658bdcb43072cee0c849d297bd9f94991738f1a0df313ceb51b093a9372f12a61987f40e7a03d773911deb270916a574962ae8ff4f2d8bfcedee1c885e9c3e54212471636a6330b05b78c3a7ddf96b013be389a08ab7971db2f68fb2689
7
7
 
8
- sample_private_key = <<EOF
9
- -----BEGIN RSA PRIVATE KEY-----
10
- MIIEowIBAAKCAQEAmm+kxDsyjD0EwfvASYU5IYtnKOQc019tJ9SR73BfCyCD3BrJd9oZ9UuoKwRH
11
- c/IGZ+lifFQ6uztBtuueQxjKPGj0h7vQ8cnuqaMQG30dGAmDxUQKxBg+eOniVvpofYqsY7IWF6Sw
12
- KzW/XjB6O3aWGhbNhJPpI1NrNMwrLajUUiDVfvIkOwgbVV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UAgSmDQxSIgK
31
+ -----END RSA PRIVATE KEY-----
32
32
  EOF
33
33
  sample_public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCab6TEOzKMPQTB+8BJhTkhi2co5BzTX20n1JHvcF8LIIPcGsl32hn1S6grBEdz8gZn6WJ8VDq7O0G2655DGMo8aPSHu9Dxye6poxAbfR0YCYPFRArEGD546eJW+mh9iqxjshYXpLArNb9eMHo7dpYaFs2Ek+kjU2s0zCstqNRSINV+8iQ7CBtVW4Tx2greDolsKqlpEbQUMLWer3Xb/7fqp8Wzpoby1Hok47fxrLCET4Si/txjZgrjZrgAzZRICT1rHZZQPrt4B7SCV+FsPYp8mozF3WMRaqZzvZ4JdU3gk1hIbnQ+NMajZC7rZLIgjvyW3zkVFXJVenVji9BZwhpV"
34
34
 
35
35
  def key_to_format(key, format)
36
- keyobj, f = Cheffish::KeyFormatter.decode(key)
37
- Cheffish::KeyFormatter.encode(keyobj, { :format => format })
36
+ keyobj, _f = Cheffish::KeyFormatter.decode(key)
37
+ Cheffish::KeyFormatter.encode(keyobj, { format: format })
38
38
  end
39
39
 
40
40
  context "when computing key fingperprints" do
41
41
 
42
- it "computes the PKCS#8 SHA1 private key fingerprint correctly", :pending => (RUBY_VERSION.to_f >= 2.0) do
42
+ it "computes the PKCS#8 SHA1 private key fingerprint correctly", pending: (RUBY_VERSION.to_f >= 2.0) do
43
43
  expect(key_to_format(sample_private_key, :pkcs8sha1fingerprint)).to eq(
44
44
  "88:7e:3a:bd:26:9f:b5:c5:d8:ae:52:f9:df:0b:64:a4:5c:17:0a:87")
45
45
  end
@@ -3,7 +3,7 @@ require "cheffish/merged_config"
3
3
  describe "merged_config" do
4
4
 
5
5
  let(:config) do
6
- Cheffish::MergedConfig.new({ :test => "val" })
6
+ Cheffish::MergedConfig.new({ test: "val" })
7
7
  end
8
8
 
9
9
  let(:collision) do
@@ -13,20 +13,20 @@ describe "merged_config" do
13
13
  end
14
14
 
15
15
  let(:config_mismatch) do
16
- c1 = { :test => { :test => "val" } }
17
- c2 = { :test => [2, 3, 4] }
16
+ c1 = { test: { test: "val" } }
17
+ c2 = { test: [2, 3, 4] }
18
18
  Cheffish::MergedConfig.new(c1, c2)
19
19
  end
20
20
 
21
21
  let(:config_hashes) do
22
- c1 = { :test => { :test => "val" } }
23
- c2 = { :test => { :test2 => "val2" } }
22
+ c1 = { test: { test: "val" } }
23
+ c2 = { test: { test2: "val2" } }
24
24
  Cheffish::MergedConfig.new(c1, c2)
25
25
  end
26
26
 
27
27
  let(:nested_config) do
28
- c1 = { :test => { :test => "val" } }
29
- c2 = { :test => { :test2 => "val2" } }
28
+ c1 = { test: { test: "val" } }
29
+ c2 = { test: { test2: "val2" } }
30
30
  mc = Cheffish::MergedConfig.new(c2)
31
31
  Cheffish::MergedConfig.new(c1, mc)
32
32
  end
@@ -36,11 +36,11 @@ describe "merged_config" do
36
36
  end
37
37
 
38
38
  it "raises a NoMethodError if calling an unknown method with arguments" do
39
- expect { config.merge({ :some => "hash" }) }.to raise_error(NoMethodError)
39
+ expect { config.merge({ some: "hash" }) }.to raise_error(NoMethodError)
40
40
  end
41
41
 
42
42
  it "has an informative string representation" do
43
- expect("#{config}").to eq("{\"test\"=>\"val\"}")
43
+ expect((config).to_s).to eq("{\"test\"=>\"val\"}")
44
44
  end
45
45
 
46
46
  it "has indifferent str/sym access" do
@@ -3,7 +3,7 @@ require "cheffish"
3
3
  describe "api version" do
4
4
 
5
5
  let(:server_api) do
6
- Cheffish.chef_server_api({ :chef_server_url => "my.chef.server" })
6
+ Cheffish.chef_server_api({ chef_server_url: "my.chef.server" })
7
7
  end
8
8
 
9
9
  it "is pinned to 0" do
@@ -10,7 +10,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
10
10
  # let(:chef_config) { super().merge(log_level: :debug, stdout: STDOUT, stderr: STDERR, log_location: STDOUT) }
11
11
 
12
12
  context "Rights attributes" do
13
- when_the_chef_server "has a node named x", :osc_compat => false do
13
+ when_the_chef_server "has a node named x", osc_compat: false do
14
14
  node "x", {}
15
15
 
16
16
  it 'Converging chef_acl "nodes/x" changes nothing' do
@@ -195,7 +195,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
195
195
  end
196
196
  end
197
197
 
198
- when_the_chef_server "has a node named x with user blarghle in its acl", :osc_compat => false do
198
+ when_the_chef_server "has a node named x with user blarghle in its acl", osc_compat: false do
199
199
  user "blarghle", {}
200
200
  node "x", {} do
201
201
  acl "read" => { "actors" => %w{blarghle} }
@@ -211,7 +211,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
211
211
  end
212
212
  end
213
213
 
214
- when_the_chef_server "has a node named x with users foo and bar in all its acls", :osc_compat => false do
214
+ when_the_chef_server "has a node named x with users foo and bar in all its acls", osc_compat: false do
215
215
  user "foo", {}
216
216
  user "bar", {}
217
217
  node "x", {} do
@@ -241,7 +241,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
241
241
  ::RSpec::Matchers.define_negated_matcher :exclude, :include
242
242
 
243
243
  context "recursive" do
244
- when_the_chef_server "has a nodes container with user blarghle in its acl", :osc_compat => false do
244
+ when_the_chef_server "has a nodes container with user blarghle in its acl", osc_compat: false do
245
245
  user "blarghle", {}
246
246
  acl_for "containers/nodes", "read" => { "actors" => %w{blarghle} }
247
247
  node "x", {} do
@@ -255,8 +255,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
255
255
  rights :read, users: %w{blarghle}
256
256
  end
257
257
  end.to be_up_to_date
258
- end.to not_change { get("containers/nodes/_acl") }.
259
- and not_change { get("nodes/x/_acl") }
258
+ end.to((not_change { get("containers/nodes/_acl") }).and(not_change { get("nodes/x/_acl") }))
260
259
  end
261
260
 
262
261
  RSpec::Matchers.define_negated_matcher :not_change, :change
@@ -269,8 +268,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
269
268
  recursive :on_change
270
269
  end
271
270
  end.to be_up_to_date
272
- end.to not_change { get("containers/nodes/_acl") }.
273
- and not_change { get("nodes/x/_acl") }
271
+ end.to((not_change { get("containers/nodes/_acl") }).and(not_change { get("nodes/x/_acl") }))
274
272
  end
275
273
 
276
274
  it 'Converging chef_acl "nodes" with recursive true changes nodes/x\'s acls' do
@@ -320,7 +318,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
320
318
  end
321
319
 
322
320
  context "ACLs on each type of thing" do
323
- when_the_chef_server "has an organization named foo", :osc_compat => false, :single_org => false do
321
+ when_the_chef_server "has an organization named foo", osc_compat: false, single_org: false do
324
322
  organization "foo" do
325
323
  user "u", {}
326
324
  client "x", {}
@@ -568,7 +566,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
568
566
  end
569
567
  end
570
568
 
571
- when_the_chef_server 'has a user "u" in single org mode', :osc_compat => false do
569
+ when_the_chef_server 'has a user "u" in single org mode', osc_compat: false do
572
570
  user "u", {}
573
571
  client "x", {}
574
572
  container "x", {}
@@ -670,7 +668,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
670
668
  end
671
669
 
672
670
  context "ACLs on each container type" do
673
- when_the_chef_server "has an organization named foo", :osc_compat => false, :single_org => false do
671
+ when_the_chef_server "has an organization named foo", osc_compat: false, single_org: false do
674
672
  organization "foo" do
675
673
  user "u", {}
676
674
  client "x", {}
@@ -738,7 +736,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
738
736
  end
739
737
  end
740
738
 
741
- when_the_chef_server 'has a user "u" in single org mode', :osc_compat => false do
739
+ when_the_chef_server 'has a user "u" in single org mode', osc_compat: false do
742
740
  user "u", {}
743
741
  client "x", {}
744
742
  container "x", {}
@@ -754,7 +752,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
754
752
  %w{clients containers cookbooks data environments groups nodes roles sandboxes}.each do |type|
755
753
  it "chef_acl #{type}' changes the acl" do
756
754
  expect_recipe do
757
- chef_acl "#{type}" do
755
+ chef_acl type.to_s do
758
756
  rights :read, users: %w{u}
759
757
  end
760
758
  end.to be_updated
@@ -777,7 +775,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
777
775
  end
778
776
 
779
777
  context "remove_rights" do
780
- when_the_chef_server 'has a node "x" with "u", "c" and "g" in its acl', :osc_compat => false do
778
+ when_the_chef_server 'has a node "x" with "u", "c" and "g" in its acl', osc_compat: false do
781
779
  user "u", {}
782
780
  user "u2", {}
783
781
  client "c", {}
@@ -838,12 +836,12 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
838
836
  remove_rights :read, users: %w{u2}, clients: %w{c2}, groups: %w{g2}
839
837
  end
840
838
  end.to be_up_to_date
841
- end.not_to change { get("nodes/x/_acl") }
839
+ end.not_to(change { get("nodes/x/_acl") })
842
840
  end
843
841
  end
844
842
  end
845
843
 
846
- when_the_chef_server "has a node named data_bags", :osc_compat => false do
844
+ when_the_chef_server "has a node named data_bags", osc_compat: false do
847
845
  user "blarghle", {}
848
846
  node "data_bags", {}
849
847
 
@@ -857,7 +855,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
857
855
  end
858
856
  end
859
857
 
860
- when_the_chef_server "has a node named data_bags in multi-org mode", :osc_compat => false, :single_org => false do
858
+ when_the_chef_server "has a node named data_bags in multi-org mode", osc_compat: false, single_org: false do
861
859
  user "blarghle", {}
862
860
  organization "foo" do
863
861
  node "data_bags", {}
@@ -873,7 +871,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
873
871
  end
874
872
  end
875
873
 
876
- when_the_chef_server "has a user named data_bags in multi-org mode", :osc_compat => false, :single_org => false do
874
+ when_the_chef_server "has a user named data_bags in multi-org mode", osc_compat: false, single_org: false do
877
875
  user "data_bags", {}
878
876
  user "blarghle", {}
879
877
 
@@ -30,7 +30,7 @@ describe Chef::Resource::ChefClient do
30
30
  end.to have_updated "chef_client[blah]", :create
31
31
  client = get("clients/blah")
32
32
  expect(client["name"]).to eq("blah")
33
- key, format = Cheffish::KeyFormatter.decode(client["public_key"])
33
+ key, _format = Cheffish::KeyFormatter.decode(client["public_key"])
34
34
  expect(key).to be_public_key_for("#{repo_path}/blah.pem")
35
35
  end
36
36
  end
@@ -67,7 +67,7 @@ describe Chef::Resource::ChefClient do
67
67
  end
68
68
  end.to have_updated "chef_client[foobar]", :create
69
69
  client = get("clients/foobar")
70
- key, format = Cheffish::KeyFormatter.decode(client["public_key"])
70
+ key, _format = Cheffish::KeyFormatter.decode(client["public_key"])
71
71
  expect(key).to be_public_key_for("#{repo_path}/blah.pem")
72
72
 
73
73
  private_key = Cheffish::KeyFormatter.decode(Cheffish.get_private_key("blah"))
@@ -94,7 +94,7 @@ describe Chef::Resource::ChefClient do
94
94
  end.to have_updated "chef_client[blah]", :create
95
95
  client = get("clients/blah")
96
96
  expect(client["name"]).to eq("blah")
97
- key, format = Cheffish::KeyFormatter.decode(client["public_key"])
97
+ key, _format = Cheffish::KeyFormatter.decode(client["public_key"])
98
98
  expect(key).to be_public_key_for("#{repo_path}/blah.pem")
99
99
  end
100
100
  end
@@ -48,7 +48,7 @@ describe Chef::Resource::ChefMirror do
48
48
  action :download
49
49
  end
50
50
  end
51
- end.to raise_error /chef_mirror.concurrency must be above 0/
51
+ end.to raise_error(/chef_mirror.concurrency must be above 0/)
52
52
  end
53
53
  end
54
54
  end
@@ -158,8 +158,8 @@ describe Chef::Resource::ChefMirror do
158
158
  end.to have_updated("chef_mirror[]", :upload)
159
159
  expect { get("nodes/x") }.not_to raise_error
160
160
  expect { get("roles/x") }.not_to raise_error
161
- expect { get("nodes/y") }.to raise_error /404/
162
- expect { get("roles/y") }.to raise_error /404/
161
+ expect { get("nodes/y") }.to raise_error(/404/)
162
+ expect { get("roles/y") }.to raise_error(/404/)
163
163
  end
164
164
 
165
165
  it "Upload with chef_repo_path(:chef_repo_path) with multiple paths uploads everything" do
@@ -167,7 +167,7 @@ describe Chef::Resource::ChefMirror do
167
167
  repo2_path = path_to("repo2")
168
168
  expect_recipe do
169
169
  chef_mirror "" do
170
- chef_repo_path :chef_repo_path => [ repo_path, repo2_path ]
170
+ chef_repo_path chef_repo_path: [ repo_path, repo2_path ]
171
171
  action :upload
172
172
  end
173
173
  end.to have_updated("chef_mirror[]", :upload)
@@ -183,15 +183,15 @@ describe Chef::Resource::ChefMirror do
183
183
 
184
184
  expect_recipe do
185
185
  chef_mirror "" do
186
- chef_repo_path :chef_repo_path => "/blahblah",
187
- :node_path => "#{repo_path}/nodes",
188
- :role_path => "#{repo2_path}/roles"
186
+ chef_repo_path chef_repo_path: "/blahblah",
187
+ node_path: "#{repo_path}/nodes",
188
+ role_path: "#{repo2_path}/roles"
189
189
  action :upload
190
190
  end
191
191
  end.to have_updated("chef_mirror[]", :upload)
192
192
  expect { get("nodes/x") }.not_to raise_error
193
- expect { get("roles/x") }.to raise_error /404/
194
- expect { get("nodes/y") }.to raise_error /404/
193
+ expect { get("roles/x") }.to raise_error(/404/)
194
+ expect { get("nodes/y") }.to raise_error(/404/)
195
195
  expect { get("roles/y") }.not_to raise_error
196
196
  end
197
197
 
@@ -201,14 +201,14 @@ describe Chef::Resource::ChefMirror do
201
201
 
202
202
  expect_recipe do
203
203
  chef_mirror "" do
204
- chef_repo_path :chef_repo_path => repo_path,
205
- :role_path => "#{repo2_path}/roles"
204
+ chef_repo_path chef_repo_path: repo_path,
205
+ role_path: "#{repo2_path}/roles"
206
206
  action :upload
207
207
  end
208
208
  end.to have_updated("chef_mirror[]", :upload)
209
209
  expect { get("nodes/x") }.not_to raise_error
210
- expect { get("roles/x") }.to raise_error /404/
211
- expect { get("nodes/y") }.to raise_error /404/
210
+ expect { get("roles/x") }.to raise_error(/404/)
211
+ expect { get("nodes/y") }.to raise_error(/404/)
212
212
  expect { get("roles/y") }.not_to raise_error
213
213
  end
214
214
 
@@ -218,9 +218,9 @@ describe Chef::Resource::ChefMirror do
218
218
 
219
219
  expect_recipe do
220
220
  chef_mirror "" do
221
- chef_repo_path :chef_repo_path => %w{foo bar},
222
- :node_path => [ "#{repo_path}/nodes", "#{repo2_path}/nodes" ],
223
- :role_path => [ "#{repo_path}/roles", "#{repo2_path}/roles" ]
221
+ chef_repo_path chef_repo_path: %w{foo bar},
222
+ node_path: [ "#{repo_path}/nodes", "#{repo2_path}/nodes" ],
223
+ role_path: [ "#{repo_path}/roles", "#{repo2_path}/roles" ]
224
224
  action :upload
225
225
  end
226
226
  end.to have_updated("chef_mirror[]", :upload)