Class: Sprinkle::Actors::Local
Overview
Local Delivery Method
This actor implementation performs any given commands on your local system, as opposed to other implementations that generally run commands on a remote system via the network.
This is useful if you’d like to use Sprinkle to provision your local machine. To enable this actor, in your Sprinkle script specify the :local delivery mechanism.
deployment do
delivery :local
end
Note, your local machine will be assumed to be a member of all roles when applying policies
Instance Method Summary collapse
- #find_servers(role) ⇒ Object
-
#process(name, commands, roles, suppress_and_return_failures = false) ⇒ Object
:nodoc:.
- #put(name, uploads, roles, suppress_and_return_failures = false) ⇒ Object
Instance Method Details
#find_servers(role) ⇒ Object
45 46 47 |
# File 'lib/sprinkle/actors/local.rb', line 45 def find_servers(role) ['localhost'] end |
#process(name, commands, roles, suppress_and_return_failures = false) ⇒ Object
:nodoc:
20 21 22 23 24 25 26 |
# File 'lib/sprinkle/actors/local.rb', line 20 def process(name, commands, roles, suppress_and_return_failures = false) #:nodoc: commands.each do |command| system command return false if $?.to_i != 0 end return true end |
#put(name, uploads, roles, suppress_and_return_failures = false) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/sprinkle/actors/local.rb', line 28 def put(name, uploads, roles, suppress_and_return_failures = false) uploads.each do |file, content| retried = false begin File.open(file, "w+") { |fp| fp << content } rescue Errno::ENOENT FileUtils.mkdir_p(File.dirname(file)) if retried == false retried = true retry end end end return true end |