Class: DevLXC::CLI::Cluster

Inherits:
Thor
  • Object
show all
Defined in:
lib/dev-lxc/cli.rb

Instance Method Summary collapse

Instance Method Details

#abspath(rootfs_path) ⇒ Object



36
37
38
# File 'lib/dev-lxc/cli.rb', line 36

def abspath(rootfs_path)
  puts get_cluster(options[:config]).abspath(rootfs_path).join(" ")
end

#destroyObject



63
64
65
66
67
68
69
# File 'lib/dev-lxc/cli.rb', line 63

def destroy
  cluster = get_cluster(options[:config])
  cluster.destroy
  cluster.destroy_base_container(:unique) if options[:unique]
  cluster.destroy_base_container(:shared) if options[:shared]
  cluster.destroy_base_container(:platform) if options[:platform]
end

#init(topology = nil) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/dev-lxc/cli.rb', line 17

def init(topology=nil)
  topologies = %w(open-source standalone tier)
  if topology.nil? || ! topologies.include?(topology)
    topologies_with_index = topologies.map.with_index{ |a, i| [i+1, *a]}
    print_table topologies_with_index
    selection = ask("Which cluster topology do you want to use?", :limited_to => topologies_with_index.map{|c| c[0].to_s})
    topology = topologies[selection.to_i - 1]
  end
  puts IO.read("#{File.dirname(__FILE__)}/../../files/configs/#{topology}.yaml")
end

#run_command(command) ⇒ Object



42
43
44
# File 'lib/dev-lxc/cli.rb', line 42

def run_command(command)
  get_cluster(options[:config]).run_command(command)
end

#startObject



48
49
50
# File 'lib/dev-lxc/cli.rb', line 48

def start
  get_cluster(options[:config]).start
end

#statusObject



30
31
32
# File 'lib/dev-lxc/cli.rb', line 30

def status
  get_cluster(options[:config]).status
end

#stopObject



54
55
56
# File 'lib/dev-lxc/cli.rb', line 54

def stop
  get_cluster(options[:config]).stop
end