class Bosh::Cli::Command::Locks

Public Instance Methods

locks() click to toggle source
# File lib/cli/commands/locks.rb, line 8
def locks
  auth_required
  show_current_state

  locks = director.list_locks
  err('No locks') if locks.empty?

  show_locks_table(locks)
  say("Locks total: %d" % locks.size)
end

Private Instance Methods

show_locks_table(locks) click to toggle source
# File lib/cli/commands/locks.rb, line 21
def show_locks_table(locks)
  locks_table = table do |t|
    t.headings = ['Type', 'Resource', 'Expires at']
    locks.each do |lock|
      t << [lock['type'], lock['resource'].join(':'), Time.at(lock['timeout'].to_i).utc]
    end
  end

  nl
  say(locks_table)
  nl
end