diff bitten/slave.py @ 49:b4c51e32952b

Build slave now also handles snapshot archives in bzip2 and zip format.
author cmlenz
date Fri, 24 Jun 2005 17:26:47 +0000
parents 757aa3bf9594
children 5caccd7b247e
line wrap: on
line diff
--- a/bitten/slave.py
+++ b/bitten/slave.py
@@ -65,9 +65,22 @@
         self.channel.send_msg(beep.MIMEMessage(xml), handle_reply)
 
     def handle_msg(self, msgno, msg):
-        if msg.get_content_type() == 'application/tar':
+        content_type = msg.get_content_type()
+        if content_type in ('application/tar', 'application/zip'):
             workdir = tempfile.mkdtemp(prefix='bitten')
-            archive_name = msg.get('Content-Disposition', 'snapshot.tar.gz')
+
+            archive_name = msg.get('Content-Disposition')
+            if not archive_name:
+                if content_type == 'application/tar':
+                    encoding = msg.get('Content-Transfer-Encoding')
+                    if encoding == 'gzip':
+                        archive_name = 'snapshot.tar.gz'
+                    elif encoding == 'bzip2':
+                        archive_name = 'snapshot.tar.bz2'
+                    else:
+                        archive_name = 'snapshot.tar'
+                else:
+                    archive_name = 'snapshot.zip'
             archive_path = os.path.join(workdir, archive_name)
             file(archive_path, 'wb').write(msg.get_payload())
             logging.debug('Received snapshot archive: %s', archive_path)
Copyright (C) 2012-2017 Edgewall Software