A man who shot three rounds of live ammunition through the window of a former friend’s home in Edinburgh has been sentenced to nine years in prison.