A Leeds man was issued a warning after escaping jail for possession of drugs.