Class: Egon::Undercloud::Installer
- Inherits:
-
Object
- Object
- Egon::Undercloud::Installer
- Defined in:
- lib/egon/undercloud/installer.rb
Instance Attribute Summary collapse
-
#started ⇒ Object
(also: #started?)
readonly
Returns the value of attribute started.
Instance Method Summary collapse
- #check_ports ⇒ Object
- #completed? ⇒ Boolean
- #failure? ⇒ Boolean
-
#initialize(connection) ⇒ Installer
constructor
A new instance of Installer.
- #install(commands) ⇒ Object
- #set_completed(bool) ⇒ Object
- #set_failure(bool) ⇒ Object
Constructor Details
#initialize(connection) ⇒ Installer
Returns a new instance of Installer.
7 8 9 10 11 12 |
# File 'lib/egon/undercloud/installer.rb', line 7 def initialize(connection) @connection = connection @completed = false @started = false @failure = false end |
Instance Attribute Details
#started ⇒ Object (readonly) Also known as: started?
Returns the value of attribute started.
4 5 6 |
# File 'lib/egon/undercloud/installer.rb', line 4 def started @started end |
Instance Method Details
#check_ports ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/egon/undercloud/installer.rb', line 42 def check_ports # closed ports 5385, 36357 ports = [8774, 9292, 8777, 9696, 8004, 5000, 8585, 15672] ports.each do |p| if !@connection.port_open?(p) set_failure(true) end end end |
#completed? ⇒ Boolean
14 15 16 |
# File 'lib/egon/undercloud/installer.rb', line 14 def completed? @completed end |
#failure? ⇒ Boolean
22 23 24 |
# File 'lib/egon/undercloud/installer.rb', line 22 def failure? @failure end |
#install(commands) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/egon/undercloud/installer.rb', line 30 def install(commands) @started = true @completed = false @connection.on_complete(lambda { set_completed(true) }) @connection.on_failure(lambda { set_failure(true) }) Thread.new { @connection.execute(commands) } end |
#set_completed(bool) ⇒ Object
18 19 20 |
# File 'lib/egon/undercloud/installer.rb', line 18 def set_completed(bool) @completed = bool end |
#set_failure(bool) ⇒ Object
26 27 28 |
# File 'lib/egon/undercloud/installer.rb', line 26 def set_failure(bool) @failure = bool end |