27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/vagabond/actions/destroy.rb', line 27
def _destroy
name_required!
@destroyed ||= []
if(options[:cluster])
@cluster_name = name
@to_destroy = vagabondfile[:clusters][name] if vagabondfile[:clusters]
if(@to_destroy)
ui.info "#{ui.color('Vagabond:', :bold)} Destroying cluster - #{ui.color(name, :red)}"
else
ui.error "Cluster name provided does not exist: #{name}"
@to_destroy = []
end
else
@to_destroy = [name, @leftover_args].flatten.compact
end
remain = @to_destroy - @destroyed
@name = remain.shift
configure(:allow_missing)
if(lxc.exists?)
ui.info "#{ui.color('Vagabond:', :bold)} Destroying node: #{ui.color(name, :red)}"
do_destroy
ui.info ui.color(' -> DESTROYED', :red)
else
ui.error "Node not created: #{name}"
end
@destroyed << @name
if(@destroyed.size == @to_destroy.size)
if(@cluster_name)
@name = @cluster_name
configure
end
else
add_link(:destroy)
end
end
|