distro: 'AlmaLinux-8.6-x86_64'
description: 'AlmaLinux 8 x86_64'
shortname: 'alma8'
+ ks_repo_url: 'https://repo02.pixelpark.com/Linux/yum/almalinux/8/BaseOS/x86_64/os'
repos:
- 'almalinux-8-x86_64-baseos'
- 'almalinux-8-x86_64-appstream'
distro: 'CentOS-7.9-x86_64'
description: 'CentOS 7 x86_64'
shortname: 'centos7'
+ ks_repo_url: 'https://repo02.pixelpark.com/Linux/yum/centos/8/os/x86_64'
repos:
- 'centos-7-x86_64-baseos'
- 'centos-7-x86_64-extras'
distro: 'CentOS-Stream-8-x86_64'
description: 'CentOS Stream 8 x86_64'
shortname: 'centos8'
+ ks_repo_url: 'https://repo02.pixelpark.com/Linux/yum/centos/8-stream/BaseOS/x86_64/os'
repos:
- 'centos-stream-8-x86_64-baseos'
- 'centos-stream-8-x86_64-appstream'
distro: 'Oracle-Linux-7.9-x86_64'
description: 'Oracle Enterprise Linux 7 x86_64'
shortname: 'oel7'
+ ks_repo_url: 'https://repo02.pixelpark.com/Linux/yum/OracleLinux/OL7/ol7_latest'
repos:
- 'oraclelinux-7-x86_64-addons'
- 'oraclelinux-7-x86_64-latest'
distro: 'Rocky-8.6-x86_64'
description: 'Rocky Linux 8 x86_64'
shortname: 'rocky8'
+ ks_repo_url: 'https://repo02.pixelpark.com/Linux/yum/rockylinux/8/BaseOS/x86_64/os'
repos:
- 'rocky-8-x86_64-baseos'
- 'rocky-8-x86_64-appstream'
from packaging.version import Version
+import jinja2
+
# Own modules
from fb_tools.common import pp, to_str, is_sequence
remote_ks = self.cfg.system_ks
LOG.info(_("Ensuring currentness of system kickstart script {!r}.").format(
str(remote_ks)))
+
+ jinja_env = jinja2.Environment(
+ loader=jinja2.FileSystemLoader(str(self.base_dir / 'templates')),
+ autoescape=jinja2.select_autoescape(),
+ )
+ ks_template = jinja_env.get_template('el-standard.ks')
+ ks_content = ks_template.render(distro=self.cfg.current_distro)
+ if self.verbose > 1:
+ LOG.debug(_("Generated kickstart file content:") + '\n' + ks_content)
+
return
print_section_start(
'ensure_system_ks', 'Ensuring currentness of system kickstart script', collapsed=True)
# -------------------------------------------------------------------------
def __init__(
self, name, shortname=None, distro=None, description=None, arch=DEFAULT_DISTRO_ARCH,
- repos=None, snippets=None):
+ ks_repo_url=None, repos=None, snippets=None):
self._name = None
self._shortname = None
self._distro = None
self._description = None
self._arch = DEFAULT_DISTRO_ARCH
+ self._ks_repo_url = None
self.repos = CIStringSet()
self.snippets = CIStringSet()
self._description = desc
+ # -------------------------------------------------------------------------
+ @property
+ def ks_repo_url(self):
+ """The URL for the base installation repository."""
+ return getattr(self, '_ks_repo_url', None)
+
+ @ks_repo_url.setter
+ def ks_repo_url(self, value):
+ if value is None:
+ self._ks_repo_url = None
+ return
+
+ ks_repo_url = value.strip()
+ if ks_repo_url == '':
+ self._ks_repo_url = None
+ return
+
+ self._ks_repo_url = ks_repo_url
+
# -------------------------------------------------------------------------
def __repr__(self):
"""Typecasting into a string for reproduction."""
fields.append("distro={!r}".format(self.distro))
fields.append("arch={!r}".format(self.arch))
fields.append("description={!r}".format(self.description))
+ fields.append("ks_repo_url={!r}".format(self.ks_repo_url))
out += ", ".join(fields) + ")>"
res['distro'] = self.distro
res['arch'] = self.arch
res['description'] = self.description
+ res['ks_repo_url'] = self.ks_repo_url
return res
new = self.__class__(
self.name, shortname=self.shortname, distro=self.distro, arch=arch,
- description=self.description)
+ ks_repo_url=self.ks_repo_url, description=self.description)
for repo in self.repos:
new.repos.add(repo)
value = data[key]
if key.lower() == 'shortname' and value.strip() != '':
- new.shortname = value
+ new.shortname = value.strip()
continue
if key.lower() == 'distro' and value.strip() != '':
- new.distro = value
+ new.distro = value.strip()
continue
if key.lower() == 'description' and value.strip() != '':
- new.description = value
+ new.description = value.strip()
continue
if key.lower() == 'arch' and value.strip() != '':
- new.arch = value
+ new.arch = value.strip()
+ continue
+
+ if key.lower() == 'ks_repo_url' and value.strip() != '':
+ new.ks_repo_url = value.strip()
continue
if key.lower() == 'repos':
distro_id)
raise CrTplConfigError(msg)
+ if not distro.ks_repo_url:
+ msg = _(
+ "Did not found the base install repo URL of configured Cobbler "
+ "distro {!r}.").format( distro_id)
+ raise CrTplConfigError(msg)
+
if not len(distro.repos):
msg = _(
"Did not found repo definitions for configured Cobbler "