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.



362
363
364
# File 'lib/bosh/cli/commands/micro.rb', line 362

def index
  @index
end

#stageObject

Returns the value of attribute stage.



362
363
364
# File 'lib/bosh/cli/commands/micro.rb', line 362

def stage
  @stage
end

#totalObject

Returns the value of attribute total.



362
363
364
# File 'lib/bosh/cli/commands/micro.rb', line 362

def total
  @total
end

Instance Method Details

#enter_stage(stage, total) ⇒ Object



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

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

#finish(state) ⇒ Object



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

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

#parse_event(event) ⇒ Object



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

def parse_event(event)
  event
end

#startObject



364
365
366
367
368
369
370
371
# File 'lib/bosh/cli/commands/micro.rb', line 364

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

#update(state, task) ⇒ Object



388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/bosh/cli/commands/micro.rb', line 388

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