avoid using a variable twice in the same function

This code issue was discovered during code review while investigating docker-push failures by our private docker registry. The docker client didn't provide details about the failure, but the registry logfile pointed to exception that was raised inside __update_index_images()__.

The problem is the __data__ variable that is passed as _string_ to __update_index_images()__ but later on a _list_ is assigned to it. However the exception handler assumes the variable is still a _string_, and when that happens another exception is raised which is not handled properly by the code (and should not occur in the first place).