Councillor avoids jail after pleading guilty to carrying knife into court