class Chef::Provisioning::Machine::BasicMachine
Attributes
convergence_strategy[R]
transport[R]
Public Class Methods
new(machine_spec, transport, convergence_strategy)
click to toggle source
Calls superclass method
Chef::Provisioning::Machine::new
# File lib/chef/provisioning/machine/basic_machine.rb, line 7 def initialize(machine_spec, transport, convergence_strategy) super(machine_spec) @transport = transport @convergence_strategy = convergence_strategy end
Public Instance Methods
cleanup_convergence(action_handler)
click to toggle source
# File lib/chef/provisioning/machine/basic_machine.rb, line 24 def cleanup_convergence(action_handler) convergence_strategy.cleanup_convergence(action_handler, machine_spec) end
converge(action_handler)
click to toggle source
# File lib/chef/provisioning/machine/basic_machine.rb, line 20 def converge(action_handler) convergence_strategy.converge(action_handler, self) end
disconnect()
click to toggle source
# File lib/chef/provisioning/machine/basic_machine.rb, line 78 def disconnect transport.disconnect end
download_file(action_handler, path, local_path)
click to toggle source
# File lib/chef/provisioning/machine/basic_machine.rb, line 44 def download_file(action_handler, path, local_path) if files_different?(path, local_path) action_handler.perform_action "download file #{path} on #{machine_spec.name} to #{local_path}" do transport.download_file(path, local_path) end end end
execute(action_handler, command, options = {})
click to toggle source
# File lib/chef/provisioning/machine/basic_machine.rb, line 28 def execute(action_handler, command, options = {}) action_handler.perform_action "run '#{command}' on #{machine_spec.name}" do result = transport.execute(command, options) result.error! result end end
execute_always(command, options = {})
click to toggle source
# File lib/chef/provisioning/machine/basic_machine.rb, line 36 def execute_always(command, options = {}) transport.execute(command, options) end
make_url_available_to_remote(local_url)
click to toggle source
# File lib/chef/provisioning/machine/basic_machine.rb, line 74 def make_url_available_to_remote(local_url) transport.make_url_available_to_remote(local_url) end
read_file(path)
click to toggle source
# File lib/chef/provisioning/machine/basic_machine.rb, line 40 def read_file(path) transport.read_file(path) end
setup_convergence(action_handler)
click to toggle source
# File lib/chef/provisioning/machine/basic_machine.rb, line 16 def setup_convergence(action_handler) convergence_strategy.setup_convergence(action_handler, self) end
upload_file(action_handler, local_path, path, options = {})
click to toggle source
# File lib/chef/provisioning/machine/basic_machine.rb, line 63 def upload_file(action_handler, local_path, path, options = {}) if files_different?(path, local_path) if options[:ensure_dir] create_dir(action_handler, dirname_on_machine(path)) end action_handler.perform_action "upload file #{local_path} to #{path} on #{machine_spec.name}" do transport.upload_file(local_path, path) end end end
write_file(action_handler, path, content, options = {})
click to toggle source
# File lib/chef/provisioning/machine/basic_machine.rb, line 52 def write_file(action_handler, path, content, options = {}) if files_different?(path, nil, content) if options[:ensure_dir] create_dir(action_handler, dirname_on_machine(path)) end action_handler.perform_action "write file #{path} on #{machine_spec.name}" do transport.write_file(path, content) end end end