class TritonOps::Snapshot::Explorer
Public Class Methods
new(**options)
click to toggle source
# File lib/triton-ops/snapshot/explorer.rb, line 11 def initialize(**options) @namespace = options.fetch(:namespace) { '' } self end
Public Instance Methods
browse()
click to toggle source
# File lib/triton-ops/snapshot/explorer.rb, line 26 def browse h = headnode s = snapshot h [h, s] end
headnode()
click to toggle source
# File lib/triton-ops/snapshot/explorer.rb, line 16 def headnode return unless headnodes? prompt.select 'Which headnode?', catalog.headnodes end
snapshot(headnode)
click to toggle source
# File lib/triton-ops/snapshot/explorer.rb, line 21 def snapshot(headnode) return unless snapshots? headnode prompt.select 'Which snapshot?', catalog.snapshots(headnode) end
Private Instance Methods
catalog()
click to toggle source
# File lib/triton-ops/snapshot/explorer.rb, line 55 def catalog @catalog ||= Catalog.new namespace: @namespace end
error(message)
click to toggle source
# File lib/triton-ops/snapshot/explorer.rb, line 39 def error(message) pastel.red message end
fatal(message, status = 1)
click to toggle source
# File lib/triton-ops/snapshot/explorer.rb, line 34 def fatal(message, status = 1) error message exit status end
headnodes?()
click to toggle source
# File lib/triton-ops/snapshot/explorer.rb, line 43 def headnodes? not catalog.headnodes.empty? end
pastel()
click to toggle source
# File lib/triton-ops/snapshot/explorer.rb, line 51 def pastel @pastel ||= Pastel.new end
prompt()
click to toggle source
# File lib/triton-ops/snapshot/explorer.rb, line 59 def prompt @prompt ||= ::TTY::Prompt.new end
redis()
click to toggle source
# File lib/triton-ops/snapshot/explorer.rb, line 63 def redis @redis ||= ::Redis.new end
snapshots?(headnode)
click to toggle source
# File lib/triton-ops/snapshot/explorer.rb, line 47 def snapshots?(headnode) not catalog.snapshots(headnode).empty? end