Class: Nucleon::Action::Node::Status
- Inherits:
-
Object
- Object
- Nucleon::Action::Node::Status
- Defined in:
- lib/nucleon/action/node/status.rb
Class Method Summary collapse
-
.describe ⇒ Object
—————————————————————————– Info.
Instance Method Summary collapse
- #arguments ⇒ Object
-
#configure ⇒ Object
—————————————————————————– Settings.
-
#execute ⇒ Object
—————————————————————————– Operations.
-
#ignore ⇒ Object
—.
Class Method Details
.describe ⇒ Object
Info
10 11 12 |
# File 'lib/nucleon/action/node/status.rb', line 10 def self.describe super(:node, :status, 800) end |
Instance Method Details
#arguments ⇒ Object
32 33 34 |
# File 'lib/nucleon/action/node/status.rb', line 32 def arguments [ :status_nodes ] end |
#configure ⇒ Object
Settings
17 18 19 20 21 22 23 24 |
# File 'lib/nucleon/action/node/status.rb', line 17 def configure super do codes :network_save_failed register_nodes :status_nodes, [] register_bool :basic end end |
#execute ⇒ Object
Operations
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/nucleon/action/node/status.rb', line 39 def execute super do |local_node| ensure_network do settings[:status_nodes] = [ 'all' ] if settings[:status_nodes].empty? batch_success = network.batch(settings[:status_nodes], settings[:node_provider], settings[:parallel]) do |node| unless node.is_a?(Nucleon.provider_class(:CORL, :node, :local)) state = node.state(true) state = state.nil? ? :aborted : state.to_sym ssh_enabled = '' case state when :running, :active state = green(state.to_s) unless settings[:basic] result = node.cli.test :true if result.status == code.success ssh_enabled = '[ ' + green('SSH connected') + ' ]' else ssh_enabled = '[ ' + red('SSH connection failed') + ' ]' end end when :stopped, :aborted state = red(state.to_s) end info(state.to_s + " #{ssh_enabled}".rstrip, { :i18n => false, :prefix_text => yellow(node.plugin_provider) + ' ' + purple(node.plugin_name) }) end true end if batch_success success = network.save({ :push => true, :remote => :edit, :message => "Updating node status information.", :allow_empty => true }) myself.status = code.network_save_failed unless success else myself.status = code.batch_error end end end end |
#ignore ⇒ Object
28 29 30 |
# File 'lib/nucleon/action/node/status.rb', line 28 def ignore [ :nodes ] end |