chef-provisioning 2.0.0 → 2.0.1

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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +899 -885
  3. data/Gemfile +17 -17
  4. data/LICENSE +201 -201
  5. data/README.md +312 -312
  6. data/Rakefile +55 -55
  7. data/chef-provisioning.gemspec +38 -38
  8. data/lib/chef/provider/load_balancer.rb +75 -75
  9. data/lib/chef/provider/machine.rb +219 -219
  10. data/lib/chef/provider/machine_batch.rb +224 -224
  11. data/lib/chef/provider/machine_execute.rb +36 -35
  12. data/lib/chef/provider/machine_file.rb +55 -55
  13. data/lib/chef/provider/machine_image.rb +105 -105
  14. data/lib/chef/provisioning.rb +110 -110
  15. data/lib/chef/provisioning/action_handler.rb +68 -68
  16. data/lib/chef/provisioning/add_prefix_action_handler.rb +35 -35
  17. data/lib/chef/provisioning/chef_managed_entry_store.rb +128 -128
  18. data/lib/chef/provisioning/chef_provider_action_handler.rb +74 -74
  19. data/lib/chef/provisioning/chef_run_data.rb +132 -132
  20. data/lib/chef/provisioning/convergence_strategy.rb +28 -28
  21. data/lib/chef/provisioning/convergence_strategy/ignore_convergence_failure.rb +54 -54
  22. data/lib/chef/provisioning/convergence_strategy/install_cached.rb +188 -188
  23. data/lib/chef/provisioning/convergence_strategy/install_msi.rb +71 -71
  24. data/lib/chef/provisioning/convergence_strategy/install_sh.rb +71 -71
  25. data/lib/chef/provisioning/convergence_strategy/no_converge.rb +35 -35
  26. data/lib/chef/provisioning/convergence_strategy/precreate_chef_objects.rb +255 -255
  27. data/lib/chef/provisioning/driver.rb +323 -323
  28. data/lib/chef/provisioning/load_balancer_spec.rb +14 -14
  29. data/lib/chef/provisioning/machine.rb +112 -112
  30. data/lib/chef/provisioning/machine/basic_machine.rb +84 -84
  31. data/lib/chef/provisioning/machine/unix_machine.rb +288 -288
  32. data/lib/chef/provisioning/machine/windows_machine.rb +108 -108
  33. data/lib/chef/provisioning/machine_image_spec.rb +34 -34
  34. data/lib/chef/provisioning/machine_spec.rb +58 -58
  35. data/lib/chef/provisioning/managed_entry.rb +121 -121
  36. data/lib/chef/provisioning/managed_entry_store.rb +136 -136
  37. data/lib/chef/provisioning/recipe_dsl.rb +99 -99
  38. data/lib/chef/provisioning/rspec.rb +27 -27
  39. data/lib/chef/provisioning/transport.rb +100 -100
  40. data/lib/chef/provisioning/transport/ssh.rb +403 -403
  41. data/lib/chef/provisioning/transport/winrm.rb +144 -156
  42. data/lib/chef/provisioning/version.rb +5 -5
  43. data/lib/chef/resource/chef_data_bag_resource.rb +146 -146
  44. data/lib/chef/resource/load_balancer.rb +57 -57
  45. data/lib/chef/resource/machine.rb +128 -128
  46. data/lib/chef/resource/machine_batch.rb +78 -78
  47. data/lib/chef/resource/machine_execute.rb +30 -29
  48. data/lib/chef/resource/machine_file.rb +34 -34
  49. data/lib/chef/resource/machine_image.rb +35 -35
  50. data/lib/chef_metal.rb +1 -1
  51. data/spec/chef/provisioning/convergence_strategy/ignore_convergence_failure_spec.rb +86 -86
  52. data/spec/spec_helper.rb +27 -27
  53. metadata +5 -5
@@ -1,29 +1,30 @@
1
- require 'chef/resource/lwrp_base'
2
- require 'chef/provisioning'
3
- require 'chef/provisioning/machine'
4
- require 'chef/provisioning/driver'
5
-
6
- class Chef
7
- class Resource
8
- class MachineExecute < Chef::Resource::LWRPBase
9
-
10
- self.resource_name = 'machine_execute'
11
-
12
- def initialize(*args)
13
- super
14
- @chef_server = run_context.cheffish.current_chef_server
15
- end
16
-
17
- actions :run
18
- default_action :run
19
-
20
- attribute :command, :kind_of => String, :name_attribute => true
21
- attribute :machine, :kind_of => String
22
- attribute :live_stream, :kind_of => [TrueClass,FalseClass], :default => false
23
-
24
- attribute :chef_server, :kind_of => Hash
25
- attribute :driver, :kind_of => Chef::Provisioning::Driver
26
-
27
- end
28
- end
29
- end
1
+ require 'chef/resource/lwrp_base'
2
+ require 'chef/provisioning'
3
+ require 'chef/provisioning/machine'
4
+ require 'chef/provisioning/driver'
5
+
6
+ class Chef
7
+ class Resource
8
+ class MachineExecute < Chef::Resource::LWRPBase
9
+
10
+ self.resource_name = 'machine_execute'
11
+
12
+ def initialize(*args)
13
+ super
14
+ @chef_server = run_context.cheffish.current_chef_server
15
+ end
16
+
17
+ actions :run
18
+ default_action :run
19
+
20
+ attribute :command, :kind_of => String, :name_attribute => true
21
+ attribute :timeout, :kind_of => Integer, :default => 15*60
22
+ attribute :machine, :kind_of => String, :required => true
23
+ attribute :live_stream, :kind_of => [TrueClass,FalseClass], :default => false
24
+
25
+ attribute :chef_server, :kind_of => Hash
26
+ attribute :driver, :kind_of => Chef::Provisioning::Driver
27
+
28
+ end
29
+ end
30
+ end
@@ -1,34 +1,34 @@
1
- require 'chef/resource/lwrp_base'
2
- require 'chef/provisioning'
3
- require 'chef/provisioning/machine'
4
- require 'chef/provisioning/driver'
5
-
6
- class Chef
7
- class Resource
8
- class MachineFile < Chef::Resource::LWRPBase
9
-
10
- self.resource_name = 'machine_file'
11
-
12
- def initialize(*args)
13
- super
14
- @chef_server = run_context.cheffish.current_chef_server
15
- end
16
-
17
- actions :upload, :download, :delete, :nothing
18
- default_action :upload
19
-
20
- attribute :path, :kind_of => String, :name_attribute => true
21
- attribute :machine, :kind_of => String
22
- attribute :local_path, :kind_of => String
23
- attribute :content
24
-
25
- attribute :owner, :kind_of => String
26
- attribute :group, :kind_of => String
27
- attribute :mode, :kind_of => String
28
-
29
- attribute :chef_server, :kind_of => Hash
30
- attribute :driver, :kind_of => Chef::Provisioning::Driver
31
-
32
- end
33
- end
34
- end
1
+ require 'chef/resource/lwrp_base'
2
+ require 'chef/provisioning'
3
+ require 'chef/provisioning/machine'
4
+ require 'chef/provisioning/driver'
5
+
6
+ class Chef
7
+ class Resource
8
+ class MachineFile < Chef::Resource::LWRPBase
9
+
10
+ self.resource_name = 'machine_file'
11
+
12
+ def initialize(*args)
13
+ super
14
+ @chef_server = run_context.cheffish.current_chef_server
15
+ end
16
+
17
+ actions :upload, :download, :delete, :nothing
18
+ default_action :upload
19
+
20
+ attribute :path, :kind_of => String, :name_attribute => true
21
+ attribute :machine, :kind_of => String, :required => true
22
+ attribute :local_path, :kind_of => String
23
+ attribute :content
24
+
25
+ attribute :owner, :kind_of => String
26
+ attribute :group, :kind_of => String
27
+ attribute :mode, :kind_of => String
28
+
29
+ attribute :chef_server, :kind_of => Hash
30
+ attribute :driver, :kind_of => Chef::Provisioning::Driver
31
+
32
+ end
33
+ end
34
+ end
@@ -1,35 +1,35 @@
1
- require 'chef/resource/lwrp_base'
2
- require 'cheffish'
3
- require 'chef/provisioning'
4
- require 'cheffish/merged_config'
5
-
6
- class Chef
7
- class Resource
8
- class MachineImage < Chef::Resource::Machine
9
-
10
- self.resource_name = 'machine_image'
11
-
12
- def initialize(*args)
13
- super
14
- @image_options = run_context.chef_provisioning.current_image_options
15
- @machine_options = run_context.chef_provisioning.current_machine_options
16
- end
17
-
18
- # TODO check if we still have all the actions from machine
19
- actions :create, :destroy, :archive
20
- default_action :create
21
-
22
- attribute :image_options, :kind_of => Hash
23
-
24
- # TODO
25
- # - policy for old version cleanup
26
- # - when attributes or recipes of the machine_image changes, or when the actual
27
- # recipes therein change, we will regenerate the image
28
- # - attribute to force or turn off image updates
29
- # - ability to rebuild new image based on the previous image
30
- # - ability to specify whether and how to keep the image-building machine around
31
- # - ability to specify whether to leave the chef config around or not
32
-
33
- end
34
- end
35
- end
1
+ require 'chef/resource/lwrp_base'
2
+ require 'cheffish'
3
+ require 'chef/provisioning'
4
+ require 'cheffish/merged_config'
5
+
6
+ class Chef
7
+ class Resource
8
+ class MachineImage < Chef::Resource::Machine
9
+
10
+ self.resource_name = 'machine_image'
11
+
12
+ def initialize(*args)
13
+ super
14
+ @image_options = run_context.chef_provisioning.current_image_options
15
+ @machine_options = run_context.chef_provisioning.current_machine_options
16
+ end
17
+
18
+ # TODO check if we still have all the actions from machine
19
+ actions :create, :destroy, :archive
20
+ default_action :create
21
+
22
+ attribute :image_options, :kind_of => Hash
23
+
24
+ # TODO
25
+ # - policy for old version cleanup
26
+ # - when attributes or recipes of the machine_image changes, or when the actual
27
+ # recipes therein change, we will regenerate the image
28
+ # - attribute to force or turn off image updates
29
+ # - ability to rebuild new image based on the previous image
30
+ # - ability to specify whether and how to keep the image-building machine around
31
+ # - ability to specify whether to leave the chef config around or not
32
+
33
+ end
34
+ end
35
+ end
data/lib/chef_metal.rb CHANGED
@@ -1 +1 @@
1
- require 'chef/provisioning'
1
+ require 'chef/provisioning'
@@ -1,86 +1,86 @@
1
- require 'chef/provisioning/convergence_strategy/ignore_convergence_failure'
2
-
3
- class TestConvergenceStrategyError < RuntimeError; end
4
-
5
- class TestConvergeClass
6
- attr_reader :convergence_options, :test_error
7
- def initialize(convergence_options, test_error)
8
- @convergence_options = convergence_options
9
- @test_error = test_error
10
- end
11
- def converge(action_handler, machine)
12
- test_error.call
13
- end
14
- end
15
-
16
- describe Chef::Provisioning::ConvergenceStrategy::IgnoreConvergenceFailure do
17
-
18
- let(:test_class) do
19
- t = TestConvergeClass.new(convergence_options, test_error)
20
- t.extend(Chef::Provisioning::ConvergenceStrategy::IgnoreConvergenceFailure)
21
- t
22
- end
23
- let(:action_handler) { double("ActionHandler") }
24
-
25
- shared_examples "does not raise an error" do
26
- it "does not raise an error" do
27
- expect(action_handler).to receive(:performed_action)
28
- expect { test_class.converge(action_handler, nil) }.to_not raise_error
29
- end
30
- end
31
-
32
- context "when ignore_failures is a single Fixnum" do
33
- let(:convergence_options) { {ignore_failure: 1} }
34
- let(:test_error) { proc { exit(1) } }
35
- include_examples "does not raise an error"
36
- end
37
-
38
- context "when ignore_failures is an array of Fixnum" do
39
- let(:convergence_options) { {ignore_failure: [1, 2]} }
40
- let(:test_error) { proc { exit(1) } }
41
- include_examples "does not raise an error"
42
- end
43
-
44
- context "when ignore_failures is a Range" do
45
- let(:convergence_options) { {ignore_failure: [1, 5..10]} }
46
- let(:test_error) { proc { exit(6) } }
47
- include_examples "does not raise an error"
48
- end
49
-
50
- context "when ignore_failures is a single error class" do
51
- let(:convergence_options) { {ignore_failure: TestConvergenceStrategyError} }
52
- let(:test_error) { proc { raise TestConvergenceStrategyError } }
53
- include_examples "does not raise an error"
54
- end
55
-
56
- context "when ignore_failures is an array of errors" do
57
- let(:convergence_options) { {ignore_failure: [TestConvergenceStrategyError, NoMethodError]} }
58
- let(:test_error) { proc { raise TestConvergenceStrategyError } }
59
- include_examples "does not raise an error"
60
- end
61
-
62
- context "when ignore_failures is a different error" do
63
- let(:convergence_options) { {ignore_failure: [NoMethodError]} }
64
- let(:test_error) { proc { raise TestConvergenceStrategyError } }
65
- it "does not catch the TestConvergenceStrategyError" do
66
- expect { test_class.converge(action_handler, nil) }.to raise_error(TestConvergenceStrategyError)
67
- end
68
- end
69
-
70
- context "when ignore_failures is true" do
71
- let(:convergence_options) { {ignore_failure: true} }
72
-
73
- context "and test_error is a RuntimeError" do
74
- let(:test_error) { proc { raise TestConvergenceStrategyError } }
75
- include_examples "does not raise an error"
76
- end
77
-
78
- context "and test_error is a SystemExit error" do
79
- let(:test_error) { proc { exit(1) } }
80
- it "does not catch SystemExit errors" do
81
- expect { test_class.converge(action_handler, nil) }.to raise_error(SystemExit)
82
- end
83
- end
84
- end
85
-
86
- end
1
+ require 'chef/provisioning/convergence_strategy/ignore_convergence_failure'
2
+
3
+ class TestConvergenceStrategyError < RuntimeError; end
4
+
5
+ class TestConvergeClass
6
+ attr_reader :convergence_options, :test_error
7
+ def initialize(convergence_options, test_error)
8
+ @convergence_options = convergence_options
9
+ @test_error = test_error
10
+ end
11
+ def converge(action_handler, machine)
12
+ test_error.call
13
+ end
14
+ end
15
+
16
+ describe Chef::Provisioning::ConvergenceStrategy::IgnoreConvergenceFailure do
17
+
18
+ let(:test_class) do
19
+ t = TestConvergeClass.new(convergence_options, test_error)
20
+ t.extend(Chef::Provisioning::ConvergenceStrategy::IgnoreConvergenceFailure)
21
+ t
22
+ end
23
+ let(:action_handler) { double("ActionHandler") }
24
+
25
+ shared_examples "does not raise an error" do
26
+ it "does not raise an error" do
27
+ expect(action_handler).to receive(:performed_action)
28
+ expect { test_class.converge(action_handler, nil) }.to_not raise_error
29
+ end
30
+ end
31
+
32
+ context "when ignore_failures is a single Fixnum" do
33
+ let(:convergence_options) { {ignore_failure: 1} }
34
+ let(:test_error) { proc { exit(1) } }
35
+ include_examples "does not raise an error"
36
+ end
37
+
38
+ context "when ignore_failures is an array of Fixnum" do
39
+ let(:convergence_options) { {ignore_failure: [1, 2]} }
40
+ let(:test_error) { proc { exit(1) } }
41
+ include_examples "does not raise an error"
42
+ end
43
+
44
+ context "when ignore_failures is a Range" do
45
+ let(:convergence_options) { {ignore_failure: [1, 5..10]} }
46
+ let(:test_error) { proc { exit(6) } }
47
+ include_examples "does not raise an error"
48
+ end
49
+
50
+ context "when ignore_failures is a single error class" do
51
+ let(:convergence_options) { {ignore_failure: TestConvergenceStrategyError} }
52
+ let(:test_error) { proc { raise TestConvergenceStrategyError } }
53
+ include_examples "does not raise an error"
54
+ end
55
+
56
+ context "when ignore_failures is an array of errors" do
57
+ let(:convergence_options) { {ignore_failure: [TestConvergenceStrategyError, NoMethodError]} }
58
+ let(:test_error) { proc { raise TestConvergenceStrategyError } }
59
+ include_examples "does not raise an error"
60
+ end
61
+
62
+ context "when ignore_failures is a different error" do
63
+ let(:convergence_options) { {ignore_failure: [NoMethodError]} }
64
+ let(:test_error) { proc { raise TestConvergenceStrategyError } }
65
+ it "does not catch the TestConvergenceStrategyError" do
66
+ expect { test_class.converge(action_handler, nil) }.to raise_error(TestConvergenceStrategyError)
67
+ end
68
+ end
69
+
70
+ context "when ignore_failures is true" do
71
+ let(:convergence_options) { {ignore_failure: true} }
72
+
73
+ context "and test_error is a RuntimeError" do
74
+ let(:test_error) { proc { raise TestConvergenceStrategyError } }
75
+ include_examples "does not raise an error"
76
+ end
77
+
78
+ context "and test_error is a SystemExit error" do
79
+ let(:test_error) { proc { exit(1) } }
80
+ it "does not catch SystemExit errors" do
81
+ expect { test_class.converge(action_handler, nil) }.to raise_error(SystemExit)
82
+ end
83
+ end
84
+ end
85
+
86
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,27 +1,27 @@
1
- require 'simplecov'
2
- SimpleCov.start do
3
- # add_filter do |source_file|
4
- # # source_file.lines.count < 5
5
- # source.filename =~ /^#{SimpleCov.root}\/chef-provisioning-fake/)
6
- # end
7
- end
8
-
9
- RSpec.configure do |config|
10
- config.expect_with :rspec do |expectations|
11
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
12
- end
13
-
14
- config.mock_with :rspec do |mocks|
15
- # Prevents you from mocking or stubbing a method that does not exist on
16
- # a real object. This is generally recommended, and will default to
17
- # `true` in RSpec 4.
18
- mocks.verify_partial_doubles = true
19
- end
20
-
21
- config.run_all_when_everything_filtered = true
22
- config.filter_run :focus
23
- config.expect_with(:rspec) { |c| c.syntax = :expect }
24
-
25
- #Chef::Log.level = :debug
26
- # Chef::Config[:log_level] = :warn
27
- end
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ # add_filter do |source_file|
4
+ # # source_file.lines.count < 5
5
+ # source.filename =~ /^#{SimpleCov.root}\/chef-provisioning-fake/)
6
+ # end
7
+ end
8
+
9
+ RSpec.configure do |config|
10
+ config.expect_with :rspec do |expectations|
11
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
12
+ end
13
+
14
+ config.mock_with :rspec do |mocks|
15
+ # Prevents you from mocking or stubbing a method that does not exist on
16
+ # a real object. This is generally recommended, and will default to
17
+ # `true` in RSpec 4.
18
+ mocks.verify_partial_doubles = true
19
+ end
20
+
21
+ config.run_all_when_everything_filtered = true
22
+ config.filter_run :focus
23
+ config.expect_with(:rspec) { |c| c.syntax = :expect }
24
+
25
+ #Chef::Log.level = :debug
26
+ # Chef::Config[:log_level] = :warn
27
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-25 00:00:00.000000000 Z
11
+ date: 2016-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -87,19 +87,19 @@ dependencies:
87
87
  - !ruby/object:Gem::Version
88
88
  version: '4.0'
89
89
  - !ruby/object:Gem::Dependency
90
- name: winrm
90
+ name: winrm-fs
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '1.3'
95
+ version: '1.0'
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '1.3'
102
+ version: '1.0'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: mixlib-install
105
105
  requirement: !ruby/object:Gem::Requirement