Skip to content

Instantly share code, notes, and snippets.

@MarcGrimme
Created October 17, 2013 14:21
Show Gist options
  • Save MarcGrimme/7025764 to your computer and use it in GitHub Desktop.
Save MarcGrimme/7025764 to your computer and use it in GitHub Desktop.
interfaces_attributes
{ "interfaces_attributes"=>{
"new_interfaces"=>{
"_destroy"=>"false",
"type"=>"Nic::Managed",
"mac"=>"FF:FF:FF:FF:FF:FF",
"name"=>if params[:host][:name] then params[:host][:name] else "" end + "-srv",
"domain_id"=>@domain.id,
"subnet_id"=> if @domain.subnets and @subnet and @domain.subnets.find_by_name(@subnet.name.split("-")[0]+"-Backend") then
@domain.subnets.find_by_name(@subnet.name.split("-")[0]+"-Backend").id
else
""
end,
# ToDo: Replace if found with IP from DNS
"ip"=>begin Resolv.getaddress(params["host"]["name"]+"-srv") rescue "" end,
}
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment