This looks hacky, can you check for user_data either at the top of this method or from where it's called and return ip_addresses.first from there?

Also, is user_data actually in compute_attributes?  I thought it was a flag of the image.