Does the use of with here mean that in the event one of these _publish calls raises an exception, the file will still be gracefully closed? If that's the case, I don't think we want to write out a repomd.xml. To the consumer, it will appear to be a valid/complete repo since it will have a parsable metadata file, but depending on what caused the exception that might range from misleading to dangerous. I think it's safer that the consumer's yum bomb out saying the repo can't be reached than to have installs be broken because not all of the things that should be in the repo are actually there.