def get_iso_info(self, iso): iso_prefixes = ['/', 'http', 'https', 'ftp', 'ftps', 'tftp'] if len(filter(iso.startswith, iso_prefixes)) == 0: raise InvalidParameter("KCHTMPL0006E", {'param': iso}) try: iso_img = IsoImage(iso) return iso_img.probe() except IsoFormatError: raise InvalidParameter("KCHISO0001E", {'filename': iso})
def updater(iso_info): iso_name = os.path.basename(iso_info['path'])[:-3] duplicates = "%s/%s*" % (params['pool_path'], iso_name) for f in glob.glob(duplicates): iso_img = IsoImage(f) if (iso_info['distro'], iso_info['version']) == \ iso_img.probe(): return iso_path = iso_name + hashlib.md5(iso_info['path']).hexdigest() + \ '.iso' link_name = os.path.join(params['pool_path'], os.path.basename(iso_path)) os.symlink(iso_info['path'], link_name)