from fb_vmware.config import VSPhereConfigInfo
-from . import DEFAULT_CONFIG_DIR
+from . import DEFAULT_CONFIG_DIR, DEFAULT_DISTRO_ARCH
from .xlate import XLATOR
-__version__ = '1.9.1'
+__version__ = '1.9.2'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
"""Class for encapsulation all necessary data of a Repo definition in Cobbler."""
re_dashes = re.compile(r'[_-]')
+ valid_arch = (
+ 'i386', 'x86_64', 'ia64', 'ppc', 'ppc64', 'ppc64el', 'ppc64le',
+ 's390', 's390x', 'arm', 'aarch64')
# -------------------------------------------------------------------------
def __init__(
- self, name, shortname=None, distro=None, description=None, repos=None, snippets=None):
+ self, name, shortname=None, distro=None, description=None, arch=DEFAULT_DISTRO_ARCH,
+ repos=None, snippets=None):
self._name = None
self._shortname = None
self._distro = None
self._description = None
+ self._arch = DEFAULT_DISTRO_ARCH
self.repos = CIStringSet()
self.snippets = CIStringSet()
self.shortname = shortname
self.distro = distro
self.description = description
+ self.arch = arch
if repos:
if is_sequence(repos):
self._distro = dis
+ # -------------------------------------------------------------------------
+ @property
+ def arch(self):
+ """The name of the underlaying (real) cobbler distro."""
+ return getattr(self, '_arch', DEFAULT_DISTRO_ARCH)
+
+ @arch.setter
+ def arch(self, value):
+
+ arch = value.strip().lower()
+ if arch not in self.valid_arch:
+ msg = _(
+ "Invalid architecture {a!r} for distro {n!r} given. Valid architectures are {v}.")
+ msg = msg.format(a=value, n=self.name, v=format_list(self.valid_arch, do_repr=True))
+ raise ValueError(msg)
+
+ self._arch = arch
+
# -------------------------------------------------------------------------
@property
def description(self):
fields.append("name={!r}".format(self.name))
fields.append("shortname={!r}".format(self._shortname))
fields.append("distro={!r}".format(self.distro))
+ fields.append("arch={!r}".format(self.arch))
fields.append("description={!r}".format(self.description))
out += ", ".join(fields) + ")>"
res['name'] = self.name
res['shortname'] = self.shortname
res['distro'] = self.distro
+ res['arch'] = self.arch
res['description'] = self.description
return res
+ # -------------------------------------------------------------------------
+ def __eq__(self, other):
+
+ if not isinstance(other, CobblerDistroInfo):
+ return False
+
+ return self.name == other.name
+
# -------------------------------------------------------------------------
def __copy__(self):
new = self.__class__(
- self.name, shortname=self.shortname, distro=self.distro, description=self.description)
+ self.name, shortname=self.shortname, distro=self.distro, arch=arch,
+ description=self.description)
for repo in self.repos:
new.repos.add(repo)
new.description = value
continue
+ if key.lower() == 'arch' and value.strip() != '':
+ new.arch = value
+ continue
+
if key.lower() == 'repos':
if is_sequence(value):
for repo in value:
self.cobbler_ws_rel_filesdir = self.default_cobbler_ws_rel_filesdir
self.cobbler_distros = {}
+ self.current_distro = None
+
self.system_status = self.default_system_status
self.excluded_datastores = []
msg = _("Did not found distro {!r} in configured Cobbler distros.").format(self.os_id)
raise CrTplConfigError(msg)
- self.cobbler_distro = self.cobbler_distros[self.os_id].distro
+ self.current_distro = self.cobbler_distros[self.os_id]
+ self.cobbler_distro = self.current_distro.distro
LOG.info(_("Using OS {os!r} with cobbler distro {di!r}.").format(
os=self.os_id, di=self.cobbler_distro))