Class: Gogetit::CLI
- Inherits:
-
Thor
show all
- Includes:
- Util
- Defined in:
- lib/gogetit/cli.rb
Instance Method Summary
collapse
Methods included from Util
#check_ip_available, #get_gateway, #knife_bootstrap, #knife_remove, #ping_available?, #recognize_env, #ssh_available?, #symbolize_keys, #update_vault, #wait_until_available
Instance Method Details
#create(name) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/gogetit/cli.rb', line 29
def create(name)
abort("vlans and ipaddresses can not be used at the same time.") \
if options['vlans'] and options['ipaddresses']
case options[:provider]
when 'lxd'
Gogetit.lxd.create(name, options.to_hash)
when 'libvirt'
Gogetit.libvirt.create(name, options.to_hash)
else
abort('Invalid argument entered.')
end
if options[:chef]
knife_bootstrap(name, type, Gogetit.config, Gogetit.logger)
update_vault(Gogetit.config, Gogetit.logger)
end
Gogetit.config[:default][:user] ||= ENV['USER']
puts "ssh #{Gogetit.config[:default][:user]}@#{name}"
end
|
#list ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/gogetit/cli.rb', line 11
def list
puts "Listing LXD containers on #{Gogetit.config[:lxd][:url]}.."
system("lxc list #{Gogetit.config[:lxd][:name]}:")
puts ''
puts "Listing KVM domains on #{Gogetit.config[:libvirt][:url]}.."
system("virsh -c #{Gogetit.config[:libvirt][:url]} list --all")
end
|
#rebuild(type = nil, name) ⇒ Object
73
74
75
76
|
# File 'lib/gogetit/cli.rb', line 73
def rebuild(type=nil, name)
invoke :destroy, [name]
invoke :create, [type, name]
end
|