import re
import datetime
import pipes
-import json
import hashlib
import textwrap
import ipaddress
import tempfile
import os
-from json import JSONDecodeError
-
from pathlib import Path
# Third party modules
from .xlate import XLATOR
-__version__ = '0.9.0'
+__version__ = '0.9.1'
LOG = logging.getLogger(__name__)
self.local_ks_file.write_text(ks_content)
- # local_ks = self.base_dir / 'kickstart' / ('profile.' + self.cfg.cobbler_profile + '.ks')
remote_ks = self.cfg.cobbler_profile_ks
LOG.info(_("Ensuring currentness of profile kickstart script {!r}.").format(
str(remote_ks)))
LOG.info(_("Creating new profile {!r} ...").format(profile))
- os_id = self.cfg.os_id
distro_info = self.cfg.current_distro
comment = "Profile for creating a {} VM.".format(distro_info.description)
ks_meta = ' '.join(ks_meta_list)
args = ['system', 'add']
- # args.append('--clobber')
args.append('--name')
args.append(name)
args.append('--profile')
else:
args.append('--ksmeta')
args.append(ks_meta)
- # args.append('--kickstart')
- # args.append(str(self.cfg.system_ks))
args.append('--power-type')
args.append('apc')
args.append('--hostname')
from .xlate import XLATOR
-__version__ = '2.0.1'
+__version__ = '2.1.1'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
if repos:
if is_sequence(repos):
for repo in repos:
- self.repos.add(snippet)
+ self.repos.add(repo)
else:
msg = _("The given parameter {p!r} must be sequential type (given: {v!r}).")
raise TypeError(msg.format(p='repos', v=repos))
out += ", ".join(fields) + ")>"
-
return out
# -------------------------------------------------------------------------
def __copy__(self):
new = self.__class__(
- self.name, shortname=self.shortname, distro=self.distro, arch=arch,
+ self.name, shortname=self.shortname, distro=self.distro, arch=self.arch,
ks_repo_url=self.ks_repo_url, description=self.description)
for package in self.packages:
continue
if key.lower() == 'repos':
- if is_sequence(value):
- for repo in value:
- repo = repo.strip()
- if repo != '':
- new.repos.add(repo)
- elif value.strip() != '':
- new.repos.add(value.strip())
-
+ cls._update_repos(new, value)
continue
if key.lower() == 'packages':
- if is_sequence(value):
- for pkg in value:
- pkg = pkg.strip()
- if pkg != '' and pkg not in new.packages:
- new.packages.append(pkg)
- elif value.strip() != '':
- new.packages.add(value.strip())
-
+ cls._update_packages(new, value)
continue
if key.lower() == 'snippets':
- if is_sequence(value):
- for snippet in value:
- snippet = snippet.strip()
- if snippet != '':
- new.snippets.add(snippet)
- elif value.strip() != '':
- new.snippets.add(value.strip())
-
+ cls._update_snippets(new, value)
continue
if verbose:
return new
+ # -------------------------------------------------------------------------
+ @classmethod
+ def _update_repos(cls, new, value):
+
+ if is_sequence(value):
+ for repo in value:
+ repo = repo.strip()
+ if repo != '':
+ new.repos.add(repo)
+ elif value.strip() != '':
+ new.repos.add(value.strip())
+
+ # -------------------------------------------------------------------------
+ @classmethod
+ def _update_packages(cls, new, value):
+
+ if is_sequence(value):
+ for pkg in value:
+ pkg = pkg.strip()
+ if pkg != '' and pkg not in new.packages:
+ new.packages.add(pkg)
+ elif value.strip() != '':
+ new.packages.add(value.strip())
+
+ # -------------------------------------------------------------------------
+ @classmethod
+ def _update_snippets(cls, new, value):
+
+ if is_sequence(value):
+ for snippet in value:
+ snippet = snippet.strip()
+ if snippet != '':
+ new.snippets.add(snippet)
+ elif value.strip() != '':
+ new.snippets.add(value.strip())
+
# =============================================================================
class LdapConnectionDict(dict, FbGenericBaseObject):
for distro in self.cobbler_distros.keys():
res['cobbler_distros'][distro] = self.cobbler_distros[distro].as_dict(short=short)
-
res['root_password'] = None
if self.root_password:
if self.verbose > 4:
if not distro.ks_repo_url:
msg = _(
"Did not found the base install repo URL of configured Cobbler "
- "distro {!r}.").format( distro_id)
+ "distro {!r}.").format(distro_id)
raise CrTplConfigError(msg)
if not len(distro.repos):
from pyVmomi import vim
import ldap3
-from ldap3.core.exceptions import LDAPInvalidDnError, LDAPInvalidValueError
-from ldap3.core.exceptions import LDAPException, LDAPBindError
# Own modules
from .xlate import XLATOR
-__version__ = '2.3.0'
+__version__ = '2.3.1'
LOG = logging.getLogger(__name__)
TZ = pytz.timezone('Europe/Berlin')
msg += '\n' + pp(ai)
LOG.debug(msg)
if not ai:
- raise HandlerError(_("Did not get address infos for {h!r}, IPv4 TCP port {p}.").format(
+ raise HandlerError(_(
+ "Did not get address infos for {h!r}, IPv4 TCP port {p}.").format(
h=ip, p=22))
addr_info = random.choice(ai)
try:
self.connect_ldap()
- line = ('#' * 60) + '\n'
+ line = ('#' * 60) + '\n'
auth_keys = line
admins = self.get_ldap_admins()
- if not admins:
- msg = _("Did not found any admins below base DN {!r} with filter:")
- msg = msg.format(self.cfg.ldap_connection['default'].base_dn)
- msg += '\n' + fltr
- raise HandlerError(msg)
for uid in sorted(admins.keys(), key=str.lower):
admins[uid] = admin
+ if not admins:
+ msg = _("Did not found any admins below base DN {!r} with filter:")
+ msg = msg.format(self.cfg.ldap_connection['default'].base_dn)
+ msg += '\n' + fltr
+ raise HandlerError(msg)
+
return admins