from .xlate import XLATOR
-__version__ = '0.6.2'
+__version__ = '0.6.3'
LOG = logging.getLogger(__name__)
def scp_to(self, local_file, remote_file):
ssh = None
- proc = None
try:
elif proc.stdout:
err = proc.stdout
msg = _(
- "{dsc} {rdir!r} on host {host!r} could not be created: {err}").format(
- dsc=dsc, rdir=str(rdir), host=self.host, err=err)
+ "{dsc} {rdir!r} on host {host!r} could not be created: {err}").format(
+ dsc=dsc, rdir=str(rdir), host=self.host, err=err)
raise ExpectedCobblerError(msg)
# -------------------------------------------------------------------------
distro_list = []
proc = self.exec_cobbler(('distro', 'list'), no_simulate=True)
- lines = proc.stdout.splitlines()
for line in proc.stdout.splitlines():
distro = line.strip()
if distro:
profile_list = []
proc = self.exec_cobbler(('profile', 'list'), no_simulate=True)
- lines = proc.stdout.splitlines()
for line in proc.stdout.splitlines():
profile = line.strip()
if profile:
"""Ensure correctnes of an existing profile."""
profile = self.config.cobbler_profile
- distro = self.config.cobbler_distro
LOG.debug(_("Checking existing profile {!r} ...").format(profile))
remote_file = (
"""Creating a new profile."""
profile = self.config.cobbler_profile
- distro = self.config.cobbler_distro
LOG.info(_("Creating new profile {!r} ...").format(profile))
cur_ip = str(ip)
except ValueError as e:
msg = _("Found invalid IP address {ip!r} in leases file: {err}").format(
- ip=match.group(1), err=e)
+ ip=match.group(1), err=e)
LOG.error(msg)
continue
return assigments[mac]
return None
+
# =============================================================================
if __name__ == "__main__":
from .xlate import XLATOR
-__version__ = '1.5.7'
+__version__ = '1.5.8'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
else:
msg = _(
"The value of {what!r} must be one of {valid!r}, "
- "but found {val!r}.").format(what='system_status',
- valid=self.valid_system_status, val=value)
+ "but found {val!r}.").format(
+ what='system_status',
+ valid=self.valid_system_status, val=value)
LOG.error(msg)
continue
return pwd_hash
+
# =============================================================================
if __name__ == "__main__":
from .config import CrTplConfiguration
-from .cobbler import CobblerError, Cobbler
+from .cobbler import Cobbler
from .xlate import XLATOR
-__version__ = '1.7.5'
+__version__ = '1.7.6'
LOG = logging.getLogger(__name__)
TZ = pytz.timezone('Europe/Berlin')
LOG.info(_("Using MAC address of template VM: {!r}").format(self.tpl_macaddress))
tpl_sysname = 'template-' + self.tpl_vm_hostname
- status = 'development'
- if self.config.vsphere_host == 'vcs01.ppbrln.internal':
- status = 'production'
self.cobbler.add_system(
name=tpl_sysname, fqdn=self.tpl_vm_fqdn, mac_address=self.tpl_macaddress)
ssh = None
+ logfiles = (
+ '/var/log/boot.log',
+ '/var/log/cron',
+ '/var/log/dnf*.log',
+ '/var/log/hawkey.log',
+ '/var/log/messages',
+ '/var/log/secure',
+ '/var/log/wtmp',
+ '/var/log/vmware-*.log*',
+ '/var/log/yum*.log',
+ )
+
cmd = textwrap.dedent("""\
printf "Current host FQDN: "
hostname -f
echo "File /root/anakonda-ks.cfg not found."
fi
- for f in /var/log/boot.log /var/log/cron /var/log/dnf*.log /var/log/hawkey.log /var/log/messages /var/log/secure /var/log/wtmp /var/log/vmware-*.log* ; do
+ for f in @@@LOGFILES@@@ ; do
if [ -f "${f}" ] ; then
echo "Truncating ${f} ..."
cp /dev/null "${f}"
echo
fi
- """)
+ """).replace('@@@LOGFILES@@@', ' '.join(logfiles))
try: