def iso_ubuntu(self, name): """download an Ubuntu ISO, the mini ISO comes from a different source then the others, it will also detect and choose the current beta or alpha release when there is no stable release""" distribution, release, architecture, flavour = name.split('-') if flavour == 'mini': url = self.cfg[distribution]['url_main'] url = os.path.join(url, 'ubuntu/dists', release, 'main/installer-' + architecture, 'current/images/netboot/mini.iso') else: url = self.cfg[distribution]['url_iso'] url = os.path.join(url, release) data = utils.scrape_tag(url, 'a') isos = [link for link in data if link.endswith('.iso')] iso_split = isos[0].split('-') version = iso_split[1] if len(iso_split) == 4: iso_file = '-'.join((distribution, version, flavour, architecture)) elif len(iso_split) == 5: state = iso_split[2] iso_file = '-'.join((distribution, version, state, flavour, architecture)) logging.warning('no stable release found for "%s"', name) iso_file = iso_file + '.iso' url = os.path.join(url, iso_file) return url
def iso_ubuntu(self, name): """download an Ubuntu ISO, the mini ISO comes from a different source then the others, it will also detect and choose the current beta or alpha release when there is no stable release""" distribution, release, architecture, flavour = name.split('-') if flavour == 'mini': url = self.cfg[distribution]['url_main'] url = os.path.join(url, 'ubuntu/dists', release, 'main/installer-' + architecture, 'current/images/netboot/mini.iso') else: url = self.cfg[distribution]['url_iso'] url = os.path.join(url, release) data = utils.scrape_tag(url, 'a') isos = [link for link in data if link.endswith('.iso')] iso_split = isos[0].split('-') version = iso_split[1] if len(iso_split) == 4: iso_file = '-'.join( (distribution, version, flavour, architecture)) elif len(iso_split) == 5: state = iso_split[2] iso_file = '-'.join( (distribution, version, state, flavour, architecture)) logging.warning('no stable release found for "%s"', name) iso_file = iso_file + '.iso' url = os.path.join(url, iso_file) return url
def iso_debian(self, name): """download a Debian ISO""" distribution, release, architecture, flavour = name.split('-') if flavour == 'mini': url = self.cfg[distribution]['url_main'] url = os.path.join(url, 'debian/dists', release, 'main/installer-' + architecture, 'current/images/netboot/mini.iso') else: if release == self.cfg[distribution]['iso_current']: release = 'current' url = self.cfg[distribution]['url_iso'] url = os.path.join(url, release, architecture, 'iso-cd') data = utils.scrape_tag(url, 'a') isos = [link for link in data if link.endswith('.iso')] iso_split = isos[0].split('-') version = iso_split[1] iso_file = '-'.join(('debian', version, architecture, flavour)) iso_file = iso_file + '.iso' url = os.path.join(url, iso_file) return url