def pre_save
extract_flavor
self.bare_metal = true if attributes[:fixed_configuration_preset] and not bare_metal?
validate_attributes
if self.vlan
attributes[:vlan] = { :networkVlan => { :id => self.vlan.id } }
end
if self.private_vlan
attributes[:private_vlan] = { :networkVlan => { :id => self.private_vlan.id } }
end
if self.key_pairs
attributes[:key_pairs].map! { |key| { :id => key.respond_to?(:id) ? key.id : key } }
end
if self.network_components
self.network_components = self.network_components.map do |component|
component['maxSpeed'] = component.delete('speed') if component['speed']
component['maxSpeed'] = component.delete('max_speed') if component['max_speed']
component
end
end
if attributes[:fixed_configuration_preset].is_a? String
attributes[:fixedConfigurationPreset] = {:keyName => attributes.delete(:fixed_configuration_preset)}
end
remap_attributes(attributes, attributes_mapping)
clean_attributes
end