archivebot.py: fix template name comparison + loop refactoring

Change-Id: I9b6c156f63300269226b54f21107fd9050d72350
Merge "archivebot.py: fix template name comparison + loop refactoring"