Class: Sprinkle::Actors::Actor
Overview
Writing an actor
All actors should inherit from Sprinkle::Actors::Actor. Actors must provide the following methods:
-
#install (installer, roles, options)
-
#verify (verifier, roles, options)
-
#servers_for_role? (roles)
-
#sudo?
-
#sudo_command
Hopefully these methods are kind of fairly obvious. They should return true to indicate success and false to indicate failure. The actual commands you need to execute can be retrived from installer.install_sequence
and verifier.commands
.
Direct Known Subclasses
Capistrano, Dummy, Local, SSH, Vlad
Instance Method Summary collapse
- #install(installer, roles, options) ⇒ Object
-
#servers_for_role?(role) ⇒ Boolean
an actor must define this method so that each policy can ask the actor if there are any servers with that policy’s roles so the policy knows whether it should execute or not.
-
#sudo? ⇒ Boolean
an actor must define this and let the installers know if it plans to try and add sudo to all of their commands or not since some installers might need to handle sudo their own special way.
-
#sudo_command ⇒ Object
if an installer needs to call sudo this is the command the actor would prefer the installers to use.
- #verify(verifier, roles, options) ⇒ Object
Instance Method Details
#install(installer, roles, options) ⇒ Object
36 37 38 |
# File 'lib/sprinkle/actors/actor.rb', line 36 def install(installer, roles, ) raise "you must define install" end |
#servers_for_role?(role) ⇒ Boolean
an actor must define this method so that each policy can ask the actor if there are any servers with that policy’s roles so the policy knows whether it should execute or not
input: a single role or array of roles
32 33 34 |
# File 'lib/sprinkle/actors/actor.rb', line 32 def servers_for_role?(role) raise "please define servers_for_role?" end |
#sudo? ⇒ Boolean
an actor must define this and let the installers know if it plans to try and add sudo to all of their commands or not since some installers might need to handle sudo their own special way
43 44 45 |
# File 'lib/sprinkle/actors/actor.rb', line 43 def sudo? raise "you must define sudo?" end |
#sudo_command ⇒ Object
if an installer needs to call sudo this is the command the actor would prefer the installers to use
49 50 51 |
# File 'lib/sprinkle/actors/actor.rb', line 49 def sudo_command raise "you must define sudo_command" end |
#verify(verifier, roles, options) ⇒ Object
53 54 55 |
# File 'lib/sprinkle/actors/actor.rb', line 53 def verify(verifier, roles, ) raise "you must define verify" end |