@@ -9,6 +9,7 @@ def self.parse(network_spec, availability_zones, logger)
99 Canonicalizer . canonicalize ( name )
1010 logger = TaggedLogger . new ( logger , 'network-configuration' )
1111 name_server_parser = NetworkParser ::NameServersParser . new
12+ prefix = Network ::IPV4_DEFAULT_PREFIX_SIZE
1213
1314 validate_network_has_no_key ( 'az' , name , network_spec )
1415 validate_network_has_no_key ( 'azs' , name , network_spec )
@@ -22,15 +23,14 @@ def self.parse(network_spec, availability_zones, logger)
2223 subnets = network_spec [ 'subnets' ] . map do |subnet_properties |
2324 name_servers = name_server_parser . parse ( subnet_properties [ 'name' ] , subnet_properties )
2425 cloud_properties = safe_property ( subnet_properties , 'cloud_properties' , class : Hash , default : { } )
25- prefix = safe_property ( subnet_properties , 'prefix' , class : Integer , default : Network ::IPV4_DEFAULT_PREFIX_SIZE )
26- raise NetworkInvalidProperty , "Prefix property is not supported for dynamic networks." unless prefix == Network ::IPV4_DEFAULT_PREFIX_SIZE
26+ subnet_prefix = safe_property ( subnet_properties , 'prefix' , class : Integer , default : Network ::IPV4_DEFAULT_PREFIX_SIZE )
27+ raise NetworkInvalidProperty , "Prefix property is not supported for dynamic networks." unless subnet_prefix == Network ::IPV4_DEFAULT_PREFIX_SIZE
2728 subnet_availability_zones = parse_availability_zones ( subnet_properties , availability_zones , name )
2829 DynamicNetworkSubnet . new ( name_servers , cloud_properties , subnet_availability_zones , prefix )
2930 end
3031 else
3132 cloud_properties = safe_property ( network_spec , 'cloud_properties' , class : Hash , default : { } )
3233 # We need to set the IPv4 default value (dynamic networks only support IPv4)
33- prefix = Network ::IPV4_DEFAULT_PREFIX_SIZE
3434
3535 name_servers = name_server_parser . parse ( network_spec [ 'name' ] , network_spec )
3636 subnets = [ DynamicNetworkSubnet . new ( name_servers , cloud_properties , nil , prefix ) ]
@@ -116,7 +116,8 @@ def network_settings(reservation, default_properties = Network::REQUIRED_DEFAULT
116116
117117 config = {
118118 "type" => "dynamic" ,
119- "cloud_properties" => subnet . cloud_properties
119+ "cloud_properties" => subnet . cloud_properties ,
120+ "prefix" => @prefix . to_s ,
120121 }
121122 config [ "dns" ] = subnet . dns if subnet . dns
122123
0 commit comments