def _parse_kickstart(self, ksconf=None): if not ksconf: return ks = kickstart.read_kickstart(ksconf) self.create['ks'] = ks self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0] self._selinux_check(self.create['arch'], ks) msger.info("Retrieving repo metadata:") ksrepos = misc.get_repostrs_from_ks(ks) self.create['repomd'] = misc.get_metadata_from_repos( ksrepos, self.create['cachedir']) msger.raw(" DONE") target_archlist, archlist = misc.get_arch(self.create['repomd']) if self.create['arch']: if self.create['arch'] not in archlist: raise errors.ConfigError("Invalid arch %s for repository. Valid arches: %s"\ % (self.create['arch'], ', '.join(archlist))) else: if len(target_archlist) == 1: self.create['arch'] = str(target_archlist[0]) msger.info("\nUse detected arch %s." % target_archlist[0]) else: raise errors.ConfigError("Please specify a valid arch, "\ "your choise can be: %s" % ', '.join(archlist)) kickstart.resolve_groups(self.create, self.create['repomd'])
def _parse_kickstart(self, ksconf=None): if not ksconf: return ks = kickstart.read_kickstart(ksconf) self.create['ks'] = ks self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0] self._selinux_check (self.create['arch'], ks) msger.info("Retrieving repo metadata:") ksrepos = misc.get_repostrs_from_ks(ks) self.create['repomd'] = misc.get_metadata_from_repos(ksrepos, self.create['cachedir']) msger.raw(" DONE") target_archlist, archlist = misc.get_arch(self.create['repomd']) if self.create['arch']: if self.create['arch'] not in archlist: raise errors.ConfigError("Invalid arch %s for repository. Valid arches: %s"\ % (self.create['arch'], ', '.join(archlist))) else: if len(target_archlist) == 1: self.create['arch'] = str(target_archlist[0]) msger.info("\nUse detected arch %s." % target_archlist[0]) else: raise errors.ConfigError("Please specify a valid arch, "\ "your choise can be: %s" % ', '.join(archlist)) kickstart.resolve_groups(self.create, self.create['repomd'])
def _parse_kickstart(self, ksconf=None): if not ksconf: return ksconf = misc.normalize_ksfile(ksconf, self.create['release'], self.create['arch']) ks = kickstart.read_kickstart(ksconf) self.create['ks'] = ks self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0] self.create['name'] = misc.build_name(ksconf, self.create['release'], self.create['name_prefix'], self.create['name_suffix']) msger.info("Retrieving repo metadata:") ksrepos = misc.get_repostrs_from_ks(ks) if not ksrepos: raise errors.KsError('no valid repos found in ks file') for repo in ksrepos: if 'baseurl' in repo and repo['baseurl'].startswith("file:"): repourl = repo['baseurl'].replace('file:', '') repourl = "/%s" % repourl.lstrip('/') self.create['localrepos'].append(repourl) self.create['repomd'] = misc.get_metadata_from_repos( ksrepos, self.create['cachedir']) msger.raw(" DONE") target_archlist, archlist = misc.get_arch(self.create['repomd']) if self.create['arch']: if self.create['arch'] not in archlist: raise errors.ConfigError("Invalid arch %s for repository. " "Valid arches: %s" \ % (self.create['arch'], ', '.join(archlist))) else: if len(target_archlist) == 1: self.create['arch'] = str(target_archlist[0]) msger.info("\nUse detected arch %s." % target_archlist[0]) else: raise errors.ConfigError("Please specify a valid arch, " "the choice can be: %s" \ % ', '.join(archlist)) kickstart.resolve_groups(self.create, self.create['repomd']) # check selinux, it will block arm and btrfs image creation misc.selinux_check(self.create['arch'], [p.fstype for p in ks.handler.partition.partitions])
def _parse_kickstart(self, ksconf=None): if not ksconf: return ks = kickstart.read_kickstart(ksconf) self.create['ks'] = ks self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0] if self.create['name_prefix']: self.create['name'] = "%s-%s" % (self.create['name_prefix'], self.create['name']) msger.info("Retrieving repo metadata:") ksrepos = misc.get_repostrs_from_ks(ks) if not ksrepos: raise errors.KsError('no valid repos found in ks file') self.create['repomd'] = misc.get_metadata_from_repos( ksrepos, self.create['cachedir']) msger.raw(" DONE") self.create['rpmver'] = misc.get_rpmver_in_repo(self.create['repomd']) target_archlist, archlist = misc.get_arch(self.create['repomd']) if self.create['arch']: if self.create['arch'] not in archlist: raise errors.ConfigError("Invalid arch %s for repository. " "Valid arches: %s" \ % (self.create['arch'], ', '.join(archlist))) else: if len(target_archlist) == 1: self.create['arch'] = str(target_archlist[0]) msger.info("\nUse detected arch %s." % target_archlist[0]) else: raise errors.ConfigError("Please specify a valid arch, " "the choice can be: %s" \ % ', '.join(archlist)) kickstart.resolve_groups(self.create, self.create['repomd']) # check selinux, it will block arm and btrfs image creation misc.selinux_check(self.create['arch'], [p.fstype for p in ks.handler.partition.partitions])
def _parse_kickstart(self, ksconf=None): if not ksconf: return ks = kickstart.read_kickstart(ksconf) self.create["ks"] = ks self.create["name"] = os.path.splitext(os.path.basename(ksconf))[0] if self.create["name_prefix"]: self.create["name"] = "%s-%s" % (self.create["name_prefix"], self.create["name"]) self._selinux_check(self.create["arch"], ks) msger.info("Retrieving repo metadata:") ksrepos = misc.get_repostrs_from_ks(ks) if not ksrepos: raise errors.KsError("no valid repos found in ks file") self.create["repomd"] = misc.get_metadata_from_repos(ksrepos, self.create["cachedir"]) msger.raw(" DONE") self.create["rpmver"] = misc.get_rpmver_in_repo(self.create["repomd"]) target_archlist, archlist = misc.get_arch(self.create["repomd"]) if self.create["arch"]: if self.create["arch"] not in archlist: raise errors.ConfigError( "Invalid arch %s for repository. " "Valid arches: %s" % (self.create["arch"], ", ".join(archlist)) ) else: if len(target_archlist) == 1: self.create["arch"] = str(target_archlist[0]) msger.info("\nUse detected arch %s." % target_archlist[0]) else: raise errors.ConfigError("Please specify a valid arch, " "the choice can be: %s" % ", ".join(archlist)) kickstart.resolve_groups(self.create, self.create["repomd"])
def run(self): while True: try: task = self.__getqueue.get(block=False) stat = self.__install(task) if stat == 0: self.__putqueue.put(task, block=False) self.__quiet or \ msger.info("[+] %s" % task) else: self.__quiet or \ msger.error("[-] %s" % task) except Queue.Empty: break