Class: Dash::Cli::App::Boot

Inherits:
Object
  • Object
show all
Defined in:
lib/dash/cli/app/boot.rb

Constant Summary collapse

SHORT_CONTAINER_ID_LENGTH =

What docker container ls --quiet prints, and so what dash-proxy has always been handed as a target. docker run --detach prints the full 64-character id, so the target is its first twelve characters rather than a round trip of its own.

12

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, role, sshkit, version, barrier, cli) ⇒ Boot

Returns a new instance of Boot.



12
13
14
15
16
17
18
19
# File 'lib/dash/cli/app/boot.rb', line 12

def initialize(host, role, sshkit, version, barrier, cli)
  @host = host
  @role = role
  @version = version
  @barrier = barrier
  @sshkit = sshkit
  @cli = cli
end

Instance Attribute Details

#barrier ⇒ Object (readonly)

Returns the value of attribute barrier.



7
8
9
# File 'lib/dash/cli/app/boot.rb', line 7

def barrier
  @barrier
end

#cli ⇒ Object (readonly)

Returns the value of attribute cli.



7
8
9
# File 'lib/dash/cli/app/boot.rb', line 7

def cli
  @cli
end

#host ⇒ Object (readonly)

Returns the value of attribute host.



7
8
9
# File 'lib/dash/cli/app/boot.rb', line 7

def host
  @host
end

#role ⇒ Object (readonly)

Returns the value of attribute role.



7
8
9
# File 'lib/dash/cli/app/boot.rb', line 7

def role
  @role
end

#sshkit ⇒ Object (readonly)

Returns the value of attribute sshkit.



7
8
9
# File 'lib/dash/cli/app/boot.rb', line 7

def sshkit
  @sshkit
end

#version ⇒ Object (readonly)

Returns the value of attribute version.



7
8
9
# File 'lib/dash/cli/app/boot.rb', line 7

def version
  @version
end

Instance Method Details

#run ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/dash/cli/app/boot.rb', line 21

def run
  DASH.timings.phase("#{role} #{host}", depth: 1) do |timing|
    @timing = timing

    old_version = old_version_renamed_if_clashing

    wait_at_barrier if queuer?

    begin
      start_new_version
    rescue => e
      close_barrier if gatekeeper?
      stop_new_version
      raise
    end

    release_barrier if gatekeeper?

    if old_version
      stop_old_version(old_version)
    end
  end
end