Fix unit mapping to machines

Unit mapping to machines was broken because it was doing partial id matches on the position of the match e.g. if the machine id was "1" it would match "14/lxc/0" or if it was "2" it would match "26/lxc/0".

QA:

Deploy some services and let the simulator run. Once the number of machines is over 9 the additional units created by the simulator were being mapped to the machine with id "1". This should no longer happen.