from .xlate import XLATOR
-__version__ = '0.6.7'
+__version__ = '0.6.8'
LOG = logging.getLogger(__name__)
remote_dir = docroot / self.config.system_status
LOG.info(_("Ensuring currentness of rsyslog config files ..."))
+ print_section_start(
+ 'ensure_rsyslog_cfg_files', 'Ensuring rsyslog config files.', collapsed=True)
for local_cfg_file in files_dir.glob('*rsyslog.conf*'):
remote_cfg_file = remote_dir / local_cfg_file.name
loc=str(local_cfg_file), rem=str(remote_cfg_file)))
self.ensure_remote_file(local_cfg_file, remote_cfg_file, check_parent=False)
+ print_section_end('ensure_rsyslog_cfg_files')
+
# -------------------------------------------------------------------------
def ensure_profile_ks(self):
os_id = self.config.os_id
LOG.info(_("Creating new system {!r} ...").format(name))
- print_section_start('add_system', "Creating new system ...", collapsed=True)
if not comment:
comment = "VMWare template for creating a {} system.".format(os_id)
err = proc.stdout
msg = _("Error creating a cobbler system - returncode was {rc}: {err}").format(
rc=proc.returncode, err=err)
- print_section_end('add_system')
raise ExpectedCobblerError(msg)
- print_section_end('add_system')
self.sync()
# -------------------------------------------------------------------------
from fb_tools.vsphere.iface import VsphereVmInterface
from fb_tools.vsphere.ds import VsphereDatastore
+from . import print_section_start, print_section_end
+
from .config import CrTplConfiguration
from .cobbler import Cobbler
from .xlate import XLATOR
-__version__ = '1.8.5'
+__version__ = '1.8.6'
LOG = logging.getLogger(__name__)
TZ = pytz.timezone('Europe/Berlin')
self.cobbler.ensure_postfix_files()
self.cobbler.ensure_logrotate_files()
+ print_section_start('vmw_info', 'Collecting VMWare info', collapsed=True)
self.vsphere.get_about()
self.vsphere.get_clusters()
self.cluster = self.vsphere.get_cluster_by_name(self.config.vsphere_cluster)
+ print_section_end('vmw_info')
if self.cluster:
LOG.debug(_("Found VSphere cluster {!r}.").format(self.cluster.name))
else:
n=self.config.network, c=self.cluster.name))
return 6
+ print_section_start('vmw_networks', 'Collecting VSPhere networks ...', collapsed=True)
self.vsphere.get_networks()
+ print_section_end('vmw_networks')
+
+ print_section_start('vmw_folder', 'Ensuring VSPhere folder ...', collapsed=True)
self.vsphere.ensure_vm_folder(self.config.folder)
+ print_section_end('vmw_folder')
+
self.check_for_temp_tpl_vm(no_error=True)
self.select_data_store()
# -------------------------------------------------------------------------
def check_for_temp_tpl_vm(self, no_error=False):
- LOG.debug(_("First checking, whether {!r} exists ...").format(self.tpl_vm_fqdn))
+ LOG.info(_("First checking, whether {!r} exists ...").format(self.tpl_vm_fqdn))
+ print_section_start(
+ 'check_existing_template', "Checking for existence of template ...",
+ collapsed=True)
vm = self.vsphere.get_vm(self.tpl_vm_fqdn, no_error=no_error)
if vm:
msg = "Info about Temporary VM {!r}:".format(self.tpl_vm_fqdn)
msg += '\n' + pp(vm.config)
LOG.debug(msg)
+ print_section_end('check_existing_template')
raise TempVmExistsError(self.tpl_vm_fqdn)
LOG.debug(_("Temporary VM {!r} does not exists, will be created.").format(
self.tpl_vm_fqdn))
+ print_section_end('check_existing_template')
# -------------------------------------------------------------------------
def get_temp_tpl_vm(self):
- return self.vsphere.get_vm(self.tpl_vm_fqdn, as_vmw_obj=True)
+ print_section_start('get_temp_tpl_vm', "Get created template VM ...", collapsed=True)
+ vm = self.vsphere.get_vm(self.tpl_vm_fqdn, as_vmw_obj=True)
+ print_section_end('get_temp_tpl_vm')
+
+ return vm
# -------------------------------------------------------------------------
def select_data_store(self):
- LOG.debug(_(
+ LOG.info(_(
"Selecting a SAN based datastore with at least {:0.1f} GiB available "
"space.").format(self.config.data_size_gb))
+ print_section_start('select_data_store', "Selecting data store ...", collapsed=True)
self.vsphere.get_ds_clusters()
self.vsphere.get_datastores()
ds_to_use = self.select_simple_data_store()
if not ds_to_use:
+ print_section_end('select_data_store')
raise NoDatastoreFoundError(self.config.data_size_gb)
self.tpl_data_store = ds_to_use
LOG.info(_("Using datastore {!r} for volume of temporary VM to create.").format(
ds_to_use.name))
+ print_section_end('select_data_store')
return
# -------------------------------------------------------------------------