Class: Bosh::Cli::Command::Micro::DeployerRenderer

Inherits:
EventLogRenderer
  • Object
show all
Defined in:
lib/bosh/cli/commands/micro.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#indexObject

Returns the value of attribute index.



367
368
369
# File 'lib/bosh/cli/commands/micro.rb', line 367

def index
  @index
end

#stageObject

Returns the value of attribute stage.



367
368
369
# File 'lib/bosh/cli/commands/micro.rb', line 367

def stage
  @stage
end

#totalObject

Returns the value of attribute total.



367
368
369
# File 'lib/bosh/cli/commands/micro.rb', line 367

def total
  @total
end

Instance Method Details

#enter_stage(stage, total) ⇒ Object



383
384
385
386
387
# File 'lib/bosh/cli/commands/micro.rb', line 383

def enter_stage(stage, total)
  @stage = stage
  @total = total
  @index = 0
end

#finish(state) ⇒ Object



378
379
380
381
# File 'lib/bosh/cli/commands/micro.rb', line 378

def finish(state)
  @thread.kill
  super(state)
end

#parse_event(event) ⇒ Object



389
390
391
# File 'lib/bosh/cli/commands/micro.rb', line 389

def parse_event(event)
  event
end

#startObject



369
370
371
372
373
374
375
376
# File 'lib/bosh/cli/commands/micro.rb', line 369

def start
  @thread = Thread.new do
    loop do
      refresh
      sleep(1)
    end
  end
end

#update(state, task) ⇒ Object



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/bosh/cli/commands/micro.rb', line 393

def update(state, task)
  event = {
    "time"     => Time.now,
    "stage"    => @stage,
    "task"     => task,
    "tags"     => [],
    "index"    => @index+1,
    "total"    => @total,
    "state"    => state.to_s,
    "progress" => state == :finished ? 100 : 0
  }

  add_event(event)

  @index += 1 if state == :finished
end