This gets attributes for all files in a directory as a batch, instead of
one by one, which slightly increases speed of copy operations.
This also makes all errors more readable, by printing the whole
exception, and not just its strerror attribute.
Additional info:
This diff was started when I tested D767, which creates 26 MB / 5400
files of artifacts. For some reason, copying this dir to the minion
takes 24 seconds, while copying it back to the host (unchanged) takes 65
seconds. I tried to profile it and came up with this patch, which
reduces it to 57 seconds, but I can't find any other bottleneck. It
seems it's related to Paramiko or SFTP. One of the slowdowns is that we
need to query for file attributes remotely, which is slower than
locally, but it does not explain all the difference. It seems we'll need
to live with it.