Class: Chef::Failover
- Inherits:
-
Object
- Object
- Chef::Failover
- Defined in:
- lib/chef-failover.rb,
lib/chef-failover/version.rb,
lib/chef-failover/strategy/base.rb,
lib/chef-failover/strategy/round_robin.rb
Defined Under Namespace
Modules: Strategy
Constant Summary collapse
- VERSION =
"0.0.1"
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #add_config(args) ⇒ Object
- #config_directory ⇒ Object
- #config_filename(name) ⇒ Object
- #dispatch ⇒ Object
-
#initialize(args = {}) ⇒ Failover
constructor
A new instance of Failover.
Constructor Details
#initialize(args = {}) ⇒ Failover
Returns a new instance of Failover.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/chef-failover.rb', line 11 def initialize(args = {}) @config = {} @config[:config_directory] ||= '/etc/chef/client.d' @config[:chef_client_log] ||= '/var/log/chef/chef.log' @config[:configurations] = [] @config[:strategy] = args[:strategy] || Chef::Failover::Strategy::RoundRobin @status = {} @status[:last_run_success] = true end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
8 9 10 |
# File 'lib/chef-failover.rb', line 8 def config @config end |
#status ⇒ Object
Returns the value of attribute status.
9 10 11 |
# File 'lib/chef-failover.rb', line 9 def status @status end |
Instance Method Details
#add_config(args) ⇒ Object
22 23 24 |
# File 'lib/chef-failover.rb', line 22 def add_config(args) @config[:configurations] << args[:config_name] end |
#config_directory ⇒ Object
35 36 37 |
# File 'lib/chef-failover.rb', line 35 def config_directory @config[:config_directory] end |
#config_filename(name) ⇒ Object
31 32 33 |
# File 'lib/chef-failover.rb', line 31 def config_filename(name) self.config_directory + '/' + name.to_s end |
#dispatch ⇒ Object
26 27 28 29 |
# File 'lib/chef-failover.rb', line 26 def dispatch strategy = @config[:strategy].new(self) strategy.dispatch end |