chef-metal 0.14.2 → 0.15

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -1
  3. data/README.md +2 -257
  4. data/Rakefile +0 -4
  5. data/lib/chef_metal.rb +1 -87
  6. data/lib/chef_metal/action_handler.rb +1 -66
  7. data/lib/chef_metal/add_prefix_action_handler.rb +1 -29
  8. data/lib/chef_metal/chef_image_spec.rb +1 -106
  9. data/lib/chef_metal/chef_machine_spec.rb +1 -82
  10. data/lib/chef_metal/chef_provider_action_handler.rb +1 -72
  11. data/lib/chef_metal/chef_run_data.rb +1 -125
  12. data/lib/chef_metal/convergence_strategy.rb +1 -26
  13. data/lib/chef_metal/convergence_strategy/install_cached.rb +1 -157
  14. data/lib/chef_metal/convergence_strategy/install_msi.rb +1 -56
  15. data/lib/chef_metal/convergence_strategy/install_sh.rb +1 -53
  16. data/lib/chef_metal/convergence_strategy/no_converge.rb +1 -37
  17. data/lib/chef_metal/convergence_strategy/precreate_chef_objects.rb +1 -181
  18. data/lib/chef_metal/driver.rb +1 -288
  19. data/lib/chef_metal/image_spec.rb +1 -70
  20. data/lib/chef_metal/machine.rb +1 -110
  21. data/lib/chef_metal/machine/basic_machine.rb +1 -82
  22. data/lib/chef_metal/machine/unix_machine.rb +1 -276
  23. data/lib/chef_metal/machine/windows_machine.rb +1 -102
  24. data/lib/chef_metal/machine_spec.rb +1 -78
  25. data/lib/chef_metal/recipe_dsl.rb +1 -94
  26. data/lib/chef_metal/transport.rb +1 -87
  27. data/lib/chef_metal/transport/ssh.rb +1 -288
  28. data/lib/chef_metal/transport/winrm.rb +1 -134
  29. data/lib/chef_metal/version.rb +1 -3
  30. metadata +19 -145
  31. data/bin/metal +0 -275
  32. data/lib/chef/provider/machine.rb +0 -171
  33. data/lib/chef/provider/machine_batch.rb +0 -186
  34. data/lib/chef/provider/machine_execute.rb +0 -30
  35. data/lib/chef/provider/machine_file.rb +0 -49
  36. data/lib/chef/provider/machine_image.rb +0 -54
  37. data/lib/chef/resource/machine.rb +0 -116
  38. data/lib/chef/resource/machine_batch.rb +0 -72
  39. data/lib/chef/resource/machine_execute.rb +0 -22
  40. data/lib/chef/resource/machine_file.rb +0 -28
  41. data/lib/chef/resource/machine_image.rb +0 -29
@@ -1,116 +0,0 @@
1
- require 'chef/resource/lwrp_base'
2
- require 'cheffish'
3
- require 'chef_metal'
4
- require 'cheffish/merged_config'
5
-
6
- class Chef::Resource::Machine < Chef::Resource::LWRPBase
7
- self.resource_name = 'machine'
8
-
9
- def initialize(*args)
10
- super
11
- @chef_environment = run_context.cheffish.current_environment
12
- @chef_server = run_context.cheffish.current_chef_server
13
- @driver = run_context.chef_metal.current_driver
14
- @machine_options = run_context.chef_metal.current_machine_options
15
- end
16
-
17
- actions :allocate, :ready, :setup, :converge, :converge_only, :destroy, :stop
18
- default_action :converge
19
-
20
- # Driver attributes
21
- attribute :driver
22
- attribute :machine_options
23
-
24
- # Node attributes
25
- Cheffish.node_attributes(self)
26
-
27
- # Client keys
28
- # Options to generate private key (size, type, etc.) when the server doesn't have it
29
- attribute :private_key_options, :kind_of => Hash
30
- attribute :allow_overwrite_keys, :kind_of => [TrueClass, FalseClass]
31
-
32
- # Optionally pull the public key out to a file
33
- attribute :public_key_path, :kind_of => String
34
- attribute :public_key_format, :kind_of => String
35
-
36
- # If you really want to force the private key to be a certain key, pass these
37
- attribute :source_key
38
- attribute :source_key_path, :kind_of => String
39
- attribute :source_key_pass_phrase
40
-
41
- # Client attributes
42
- attribute :admin, :kind_of => [TrueClass, FalseClass]
43
- attribute :validator, :kind_of => [TrueClass, FalseClass]
44
-
45
- # Client Ohai hints, allows machine to enable hints
46
- # e.g. ohai_hint 'ec2' => { 'a' => 'b' } creates file ec2.json with json contents { 'a': 'b' }
47
- attribute :ohai_hints, :kind_of => Hash
48
-
49
- # Allows you to turn convergence off in the :create action by writing "converge false"
50
- # or force it with "true"
51
- attribute :converge, :kind_of => [TrueClass, FalseClass]
52
-
53
- # A list of files to upload, in the format REMOTE_PATH => LOCAL_PATH|HASH.
54
- # == Examples
55
- # files '/remote/path.txt' => '/local/path.txt'
56
- # files '/remote/path.txt' => { :local_path => '/local/path.txt' }
57
- # files '/remote/path.txt' => { :content => 'woo' }
58
- attribute :files, :kind_of => Hash
59
-
60
- # The named machine_image to start from. Specify the name of a machine_image
61
- # object and the default machine_options will be set to use that image.
62
- # == Examples
63
- # from_image 'company_base_image'
64
- attribute :from_image, :kind_of => String
65
-
66
- # A single file to upload, in the format REMOTE_PATH, LOCAL_PATH|HASH.
67
- # This directive may be passed multiple times, and multiple files will be uploaded.
68
- # == Examples
69
- # file '/remote/path.txt', '/local/path.txt'
70
- # file '/remote/path.txt', { :local_path => '/local/path.txt' }
71
- # file '/remote/path.txt', { :content => 'woo' }
72
- def file(remote_path, local = nil)
73
- @files ||= {}
74
- if remote_path.is_a?(Hash)
75
- if local
76
- raise "file(Hash, something) does not make sense. Either pass a hash, or pass a pair, please."
77
- end
78
- remote_path.each_pair do |remote, local|
79
- @files[remote] = local
80
- end
81
- elsif remote_path.is_a?(String)
82
- if !local
83
- raise "Must pass both a remote path and a local path to file directive"
84
- end
85
- @files[remote_path] = local
86
- else
87
- raise "file remote_path must be a String, but is a #{remote_path.class}"
88
- end
89
- end
90
-
91
- def add_machine_options(options)
92
- @machine_options = Cheffish::MergedConfig.new(options, @machine_options)
93
- end
94
-
95
-
96
- # This is here because metal users will probably want to do things like:
97
- # machine "foo"
98
- # action :destroy
99
- # end
100
- #
101
- # with_machine_options :bootstrap_options => {...}
102
- # machine "foo"
103
- # converge true
104
- # end
105
- #
106
- # Without this, the first resource's machine options will obliterate the second
107
- # resource's machine options, and then unexpected (and undesired) things happen.
108
- def load_prior_resource
109
- Chef::Log.debug "Overloading #{self.resource_name} load_prior_resource with NOOP"
110
- end
111
-
112
- # chef client version and omnibus
113
- # chef-zero boot method?
114
- # chef-client -z boot method?
115
- # pushy boot method?
116
- end
@@ -1,72 +0,0 @@
1
- require 'chef/resource/lwrp_base'
2
- require 'chef/mixin/deep_merge'
3
-
4
- class Chef::Resource::MachineBatch < Chef::Resource::LWRPBase
5
- self.resource_name = 'machine_batch'
6
-
7
- def initialize(*args)
8
- super
9
- @machines = []
10
- @driver = run_context.chef_metal.current_driver
11
- @chef_server = run_context.cheffish.current_chef_server
12
- @machine_options = run_context.chef_metal.current_machine_options
13
- end
14
-
15
- actions :allocate, :ready, :setup, :converge, :converge_only, :destroy, :stop
16
- default_action :converge
17
-
18
- attribute :machines, :kind_of => [ Array ]
19
- attribute :max_simultaneous, :kind_of => [ Integer ]
20
- attribute :from_recipe
21
-
22
- # These four attributes are for when you pass names or MachineSpecs to
23
- # "machines". Not used for auto-batch or explicit inline machine declarations.
24
- attribute :driver
25
- attribute :chef_server
26
- attribute :machine_options
27
- attribute :files, :kind_of => [ Array ]
28
-
29
- def machines(*values)
30
- if values.size == 0
31
- @machines
32
- else
33
- @machines += values.flatten
34
- end
35
- end
36
-
37
- def machine(name, &block)
38
- machines << from_recipe.build_resource(:machine, name, caller[0], &block)
39
- end
40
-
41
- def add_machine_options(options)
42
- @machine_options = Chef::Mixin::DeepMerge.hash_only_merge(@machine_options, options)
43
- end
44
-
45
- # We override this because we want to hide @from_recipe and shorten @machines
46
- # in error output.
47
- def to_text
48
- ivars = instance_variables.map { |ivar| ivar.to_sym } - HIDDEN_IVARS - [ :@from_recipe, :@machines ]
49
- text = "# Declared in #{@source_line}\n\n"
50
- text << self.class.dsl_name + "(\"#{name}\") do\n"
51
- ivars.each do |ivar|
52
- if (value = instance_variable_get(ivar)) && !(value.respond_to?(:empty?) && value.empty?)
53
- value_string = value.respond_to?(:to_text) ? value.to_text : value.inspect
54
- text << " #{ivar.to_s.sub(/^@/,'')} #{value_string}\n"
55
- end
56
- end
57
- machine_names = @machines.map do |m|
58
- if m.is_a?(ChefMetal::MachineSpec)
59
- m.name
60
- elsif m.is_a?(Chef::Resource::Machine)
61
- m.name
62
- else
63
- m
64
- end
65
- end
66
- text << " machines #{machine_names.inspect}\n"
67
- [@not_if, @only_if].flatten.each do |conditional|
68
- text << " #{conditional.to_text}\n"
69
- end
70
- text << "end\n"
71
- end
72
- end
@@ -1,22 +0,0 @@
1
- require 'chef/resource/lwrp_base'
2
- require 'chef_metal'
3
- require 'chef_metal/machine'
4
- require 'chef_metal/driver'
5
-
6
- class Chef::Resource::MachineExecute < Chef::Resource::LWRPBase
7
- self.resource_name = 'machine_execute'
8
-
9
- def initialize(*args)
10
- super
11
- @chef_server = run_context.cheffish.current_chef_server
12
- end
13
-
14
- actions :run
15
- default_action :run
16
-
17
- attribute :command, :kind_of => String, :name_attribute => true
18
- attribute :machine, :kind_of => String
19
-
20
- attribute :chef_server, :kind_of => Hash
21
- attribute :driver, :kind_of => ChefMetal::Driver
22
- end
@@ -1,28 +0,0 @@
1
- require 'chef/resource/lwrp_base'
2
- require 'chef_metal'
3
- require 'chef_metal/machine'
4
- require 'chef_metal/driver'
5
-
6
- class Chef::Resource::MachineFile < Chef::Resource::LWRPBase
7
- self.resource_name = 'machine_file'
8
-
9
- def initialize(*args)
10
- super
11
- @chef_server = run_context.cheffish.current_chef_server
12
- end
13
-
14
- actions :upload, :download, :delete, :nothing
15
- default_action :upload
16
-
17
- attribute :path, :kind_of => String, :name_attribute => true
18
- attribute :machine, :kind_of => String
19
- attribute :local_path, :kind_of => String
20
- attribute :content
21
-
22
- attribute :owner, :kind_of => String
23
- attribute :group, :kind_of => String
24
- attribute :mode, :kind_of => String
25
-
26
- attribute :chef_server, :kind_of => Hash
27
- attribute :driver, :kind_of => ChefMetal::Driver
28
- end
@@ -1,29 +0,0 @@
1
- require 'chef/resource/lwrp_base'
2
- require 'cheffish'
3
- require 'chef_metal'
4
- require 'cheffish/merged_config'
5
-
6
- class Chef::Resource::MachineImage < Chef::Resource::Machine
7
- self.resource_name = 'machine_image'
8
-
9
- def initialize(*args)
10
- super
11
- @image_options = run_context.chef_metal.current_image_options
12
- @machine_options = run_context.chef_metal.current_machine_options
13
- end
14
-
15
- # TODO check if we still have all the actions from machine
16
- actions :create, :destroy, :archive
17
- default_action :create
18
-
19
- attribute :image_options, :kind_of => Hash
20
-
21
- # TODO
22
- # - policy for old version cleanup
23
- # - when attributes or recipes of the machine_image changes, or when the actual
24
- # recipes therein change, we will regenerate the image
25
- # - attribute to force or turn off image updates
26
- # - ability to rebuild new image based on the previous image
27
- # - ability to specify whether and how to keep the image-building machine around
28
- # - ability to specify whether to leave the chef config around or not
29
- end