class Wire::DownCommand
DownCommand
reads yaml, parses model elements and brings all defined model elements “down”, that is stopping and removing bridges, containers etc.
-
:target_dir
Attributes
handler[R]
allow to get access to handler object
Public Class Methods
new()
click to toggle source
initializes DownCommand
, creates handler
Calls superclass method
# File lib/wire/commands/down_command.rb, line 18 def initialize super @handler = DownCommandHandler.new end
Public Instance Methods
run_on_zone(zone_name)
click to toggle source
run in given zone: returns:
-
bool: true if successful, false otherwise
# File lib/wire/commands/down_command.rb, line 26 def run_on_zone(zone_name) b_result = true networks = @project.get_element('networks') # select appgroups in this zone and take them down first appgroups_in_zone = objects_in_zone('appgroups', zone_name) appgroups_in_zone.each do |appgroup_name, appgroup_data| $log.debug("Processing appgroup \'#{appgroup_name}\'") # process network attachments zone_networks = objects_in_zone('networks', zone_name) success = handler.handle_network_attachments(zone_name, zone_networks, appgroup_name, appgroup_data, @project.target_dir) b_result &= success # then take down containers success = handler.handle_appgroup(zone_name, appgroup_name, appgroup_data, @project.target_dir) b_result &= success end # select networks in current zone only networks_in_zone = UpDownCommand.get_networks_for_zone(networks, zone_name) networks_in_zone.each do |network_name, network_data| $log.debug("Bringing down network #{network_name}") # if we have dhcp, unconfigure dnsmasq b_result &= default_handle_dhcp(zone_name, network_name, network_data, @handler) # if we have a host ip on that bridge, take it down first b_result &= default_handle_hostip(network_name, network_data, @handler) # we should have a bridge with that name. success = @handler.handle_bridge(network_name) b_result &= success end b_result end