Class: Egon::Undercloud::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/egon/undercloud/installer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#startedObject (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_portsObject



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

Returns:

  • (Boolean)


14
15
16
# File 'lib/egon/undercloud/installer.rb', line 14

def completed?
  @completed
end

#failure?Boolean

Returns:

  • (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