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



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

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

#chef_repoObject



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

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

#destroyObject



70
71
72
73
74
75
76
# File 'lib/dev-lxc/cli.rb', line 70

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

#init(topology = nil) ⇒ Object



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

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}.yml")
end

#run_command(command) ⇒ Object



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

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

#startObject



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

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

#statusObject



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

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

#stopObject



61
62
63
# File 'lib/dev-lxc/cli.rb', line 61

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