def factory_produce(self, config, item_dict): """ Return a Distro forged from item_dict """ new_repo = repo.Repo(config) new_repo.from_dict(item_dict) return new_repo
def apt_repo_adder(self, distro): self.logger.info("adding apt repo for %s" % distro.name) # Obtain repo mirror from APT if available mirror = False if apt_available: # Example returned URL: http://us.archive.ubuntu.com/ubuntu mirror = self.get_repo_mirror_from_apt() if not mirror: mirror = "http://archive.ubuntu.com/ubuntu" repo = item_repo.Repo(self.collection_mgr) repo.set_breed("apt") repo.set_arch(distro.arch) repo.set_keep_updated(True) repo.set_apt_components("main universe") # TODO: make a setting? repo.set_apt_dists("%s %s-updates %s-security" % ((distro.os_version, ) * 3)) repo.set_name(distro.name) repo.set_os_version(distro.os_version) if distro.breed == "ubuntu": repo.set_mirror(mirror) else: # NOTE : The location of the mirror should come from timezone repo.set_mirror("http://ftp.%s.debian.org/debian/dists/%s" % ('us', distro.os_version)) self.logger.info("Added repos for %s" % distro.name) repos = self.collection_mgr.repos() repos.add(repo, save=True)
def new_repo(self, is_subobject=False): self.log("new_repo", [is_subobject]) return item_repo.Repo(self._collection_mgr, is_subobject=is_subobject)
def factory_produce(self, config, seed_data): """ Return a Distro forged from seed_data """ return repo.Repo(config).from_datastruct(seed_data)