Skip to content

Commit

Permalink
register_satellite.rb - fix issue when dealing with dvs networks (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
itewk authored and curt-matthews committed May 24, 2018
1 parent d61e326 commit 046f7c6
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ def get_network_configuration(network_name)
begin
escaped_network_name = network_name.gsub(/[^a-zA-Z0-9_\.\-]/, '_')
@network_configurations[network_name] = $evm.instantiate("#{NETWORK_CONFIGURATION_URI}/#{escaped_network_name}")

if escaped_network_name =~ /^dvs_/ && @network_configurations[network_name]['network_address_space'].blank?
escaped_network_name = escaped_network_name[/^dvs_(.*)/, 1]
@network_configurations[network_name] = $evm.instantiate("#{NETWORK_CONFIGURATION_URI}/#{escaped_network_name}")
end
rescue
@missing_network_configurations[network_name] = "WARN: No network configuration exists"
$evm.log(:warn, "No network configuration for Network <#{network_name}> (escaped <#{escaped_network_name}>) exists")
Expand Down Expand Up @@ -265,6 +270,7 @@ def to_tag_name(str)
miq_provision.get_option(:vlan) || $evm.vmdb(:cloud_subnet).find_by_id(miq_provision.get_option(:cloud_subnet)).name
$evm.log(:info, "network_name => #{network_name}") if @DEBUG
network_configuration = get_network_configuration(network_name)
error("Could not find required network configuration for Network <#{network_name}>") if network_configuration.blank?
network_address_space = network_configuration['network_address_space']
network_address, network_cidr = network_address_space.split('/')
network_netmask = IPAddr.new('255.255.255.255').mask(network_cidr).to_s
Expand Down

0 comments on commit 046f7c6

Please sign in to comment.