Class: Command::NodeDetach

Inherits:
CrowbarNodeCommand show all
Defined in:
lib/command/node_detach.rb

Overview

Allows to detach a node

Instance Attribute Summary collapse

Attributes inherited from BasicCommand

#logger, #receiver

Instance Method Summary collapse

Constructor Details

#initialize(node_name) ⇒ NodeDetach

Default constructor

Parameters:

  • node_name (String)

    The name of the node

Author:

  • mbretaud



16
17
18
19
20
# File 'lib/command/node_detach.rb', line 16

def initialize(node_name)
  super()
  @logger.info("Command::NodeDetach   initialize the parameters...")
  @node_name = node_name
end

Instance Attribute Details

#node_nameObject (readonly)

Returns the value of attribute node_name.



10
11
12
# File 'lib/command/node_detach.rb', line 10

def node_name
  @node_name
end

Instance Method Details

#execObject

Method who call crowbar receiver in order to detach a node

Author:

  • mbretaud



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/command/node_detach.rb', line 24

def exec()
  begin
    @receiver.crowbar_node_delete_proposal(@node_name)
  rescue => e
    puts "Error: Delete the node '#{@node_name}' in all proposals : " + e.message
  end

  begin
    @receiver.crowbar_node_delete(@node_name)
  rescue => e
    puts "Error: Delete the node '#{@node_name}' of Crowbar : " + e.message
  end

  begin
    @receiver.crowbar_erase_node_server(@node_name)
  rescue => e
    puts "Error: Erase the node '#{@node_name}' in the server Crowbar : " + e.message
  end
end