Example #1
0
 def _set_archive(self):
     archive_name = os.path.join(self.tmpdir,
                                 self.policy.get_archive_name())
     if self.opts.compression_type == 'auto':
         auto_archive = self.policy.get_preferred_archive()
         self.archive = auto_archive(archive_name, self.tmpdir)
     elif self.opts.compression_type == 'zip':
         self.archive = ZipFileArchive(archive_name, self.tmpdir)
     else:
         self.archive = TarFileArchive(archive_name, self.tmpdir)
     self.archive.set_debug(True if self.opts.debug else False)
Example #2
0
 def _set_archive(self):
     if self.opts.compression_type not in ('auto', 'zip', 'bzip2', 'gzip', 'xz'):
         raise Exception("Invalid compression type specified. Options are: auto, zip, bzip2, gzip and xz")
     archive_name = os.path.join(self.opts.tmp_dir,self.policy.get_archive_name())
     if self.opts.compression_type == 'auto':
         auto_archive = self.policy.preferred_archive_name()
         self.archive = auto_archive(archive_name)
     elif self.opts.compression_type == 'zip':
         self.archive = ZipFileArchive(archive_name)
     else:
         self.archive = TarFileArchive(archive_name)
 def setUp(self):
     self.zf = ZipFileArchive('test')