Class: Souffle::Provisioner::Node
- Inherits:
-
Object
- Object
- Souffle::Provisioner::Node
- Defined in:
- lib/souffle/provisioner/node.rb
Overview
The node provisioning statemachine.
Instance Attribute Summary collapse
-
#time_used ⇒ Object
Returns the value of attribute time_used.
Instance Method Summary collapse
-
#boot ⇒ Object
Boots up the node and waits for ssh.
-
#create ⇒ Object
Creates the node from an api or command.
-
#error_handler ⇒ Object
Handles any.
-
#format_device ⇒ Object
Formats a device to the configured filesystem.
-
#initialize(node, max_failures = 3) ⇒ Node
constructor
Creates a new node provisioner state machine.
-
#kill ⇒ Object
Kills the node entirely.
-
#kill_and_recreate ⇒ Object
Kills the node and restarts the creation loop.
-
#node_provisioned ⇒ Object
Notifies the system that the current node has completed provisioning.
-
#partition_device ⇒ Object
Partitions the soon to be raid device.
-
#provider ⇒ Object
Helper function for the node’s system provider.
-
#provision ⇒ Object
Provisions the given node with a chef/chef-solo run.
-
#ready ⇒ Object
Notify the logger when the node is ready for provisioning.
-
#setup_mdadm ⇒ Object
Installs and sets up mdadm.
-
#setup_raid ⇒ Object
Sets up raid to the configured raid-level.
-
#system_provisioner ⇒ Object
Helper function for the system provisioner.
Constructor Details
#initialize(node, max_failures = 3) ⇒ Node
Creates a new node provisioner state machine.
83 84 85 86 87 88 |
# File 'lib/souffle/provisioner/node.rb', line 83 def initialize(node, max_failures=3) @time_used = 0 @node = node @max_failures = max_failures super() # NOTE: This is here to initialize state_machine. end |
Instance Attribute Details
#time_used ⇒ Object
Returns the value of attribute time_used.
5 6 7 |
# File 'lib/souffle/provisioner/node.rb', line 5 def time_used @time_used end |
Instance Method Details
#boot ⇒ Object
Boots up the node and waits for ssh.
97 98 99 100 |
# File 'lib/souffle/provisioner/node.rb', line 97 def boot Souffle::Log.info "#{@node.log_prefix} Booting node..." provider.boot(@node) end |
#create ⇒ Object
Creates the node from an api or command.
91 92 93 94 |
# File 'lib/souffle/provisioner/node.rb', line 91 def create Souffle::Log.info "#{@node.log_prefix} Creating a new node..." provider.create_node(@node) end |
#error_handler ⇒ Object
Handles any
156 157 158 |
# File 'lib/souffle/provisioner/node.rb', line 156 def error_handler Souffle::Log.info "#{@node.log_prefix} Handling node error..." end |
#format_device ⇒ Object
Formats a device to the configured filesystem.
115 116 117 118 |
# File 'lib/souffle/provisioner/node.rb', line 115 def format_device Souffle::Log.info "#{@node.log_prefix} Formatting the device..." provider.format_device(@node) end |
#kill ⇒ Object
Kills the node entirely.
144 145 146 147 |
# File 'lib/souffle/provisioner/node.rb', line 144 def kill Souffle::Log.info "#{@node.log_prefix} Killing node..." provider.kill(@node) end |
#kill_and_recreate ⇒ Object
Kills the node and restarts the creation loop.
150 151 152 153 |
# File 'lib/souffle/provisioner/node.rb', line 150 def kill_and_recreate Souffle::Log.info "#{@node.log_prefix} Recreating node..." provider.kill_and_recreate(@node) end |
#node_provisioned ⇒ Object
Notifies the system that the current node has completed provisioning.
138 139 140 141 |
# File 'lib/souffle/provisioner/node.rb', line 138 def node_provisioned Souffle::Log.info "#{@node.log_prefix} Node provisioned." system_provisioner.node_provisioned end |
#partition_device ⇒ Object
Partitions the soon to be raid device.
109 110 111 112 |
# File 'lib/souffle/provisioner/node.rb', line 109 def partition_device Souffle::Log.info "#{@node.log_prefix} Partitioning the device..." provider.partition(@node) end |
#provider ⇒ Object
Helper function for the node’s system provider.
161 162 163 |
# File 'lib/souffle/provisioner/node.rb', line 161 def provider @node.provider end |
#provision ⇒ Object
Provisions the given node with a chef/chef-solo run.
132 133 134 135 |
# File 'lib/souffle/provisioner/node.rb', line 132 def provision Souffle::Log.info "#{@node.log_prefix} Provisioning node..." provider.provision(@node) end |
#ready ⇒ Object
Notify the logger when the node is ready for provisioning.
127 128 129 |
# File 'lib/souffle/provisioner/node.rb', line 127 def ready Souffle::Log.info "#{@node.log_prefix} Is ready for provisioning..." end |
#setup_mdadm ⇒ Object
Installs and sets up mdadm.
103 104 105 106 |
# File 'lib/souffle/provisioner/node.rb', line 103 def setup_mdadm Souffle::Log.info "#{@node.log_prefix} Setting up mdadm..." provider.setup_mdadm(@node) end |
#setup_raid ⇒ Object
Sets up raid to the configured raid-level.
121 122 123 124 |
# File 'lib/souffle/provisioner/node.rb', line 121 def setup_raid Souffle::Log.info "#{@node.log_prefix} Setting up raid..." provider.setup_raid(@node) end |
#system_provisioner ⇒ Object
Helper function for the system provisioner.
166 167 168 |
# File 'lib/souffle/provisioner/node.rb', line 166 def system_provisioner @node.system.provisioner end |