Class: Nucleon::Action::Node::Status
- Inherits:
-
Object
- Object
- Nucleon::Action::Node::Status
- Includes:
- Mixin::Action::Registration
- 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
12 13 14 |
# File 'lib/nucleon/action/node/status.rb', line 12 def self.describe super(:node, :status, 800) end |
Instance Method Details
#arguments ⇒ Object
33 34 35 |
# File 'lib/nucleon/action/node/status.rb', line 33 def arguments [ :status_nodes ] end |
#configure ⇒ Object
Settings
19 20 21 22 23 24 25 |
# File 'lib/nucleon/action/node/status.rb', line 19 def configure super do register_nodes :status_nodes, [] register_bool :basic end end |
#execute ⇒ Object
Operations
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 |
# File 'lib/nucleon/action/node/status.rb', line 40 def execute super do |local_node, network| ensure_network(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| state = node.state(true).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('connected') + ' ]' else ssh_enabled = '[ ' + red('connection failed') + ' ]' end end when :stopped, :aborted state = red(state.to_s) end info(state + " #{ssh_enabled}".rstrip, { :i18n => false, :prefix_text => yellow(node.plugin_provider) + ' ' + purple(node.plugin_name) }) true end myself.status = code.batch_error unless batch_success end end end |
#ignore ⇒ Object
29 30 31 |
# File 'lib/nucleon/action/node/status.rb', line 29 def ignore [ :nodes ] end |