Skip to content

Commit

Permalink
Issue 4875 - CLI - Add some verbosity to installer
Browse files Browse the repository at this point in the history
Description:  Previously the installer would basically say
              "Starting" and "Finished".  If a step would
              run into a problem it is difficult to narrow
              down what is going wrong.  So add a little more
              output during the installation.

relates: #4875

Reviewed by: firstyear & spichugi(Thanks!!)
  • Loading branch information
mreynolds389 committed Aug 26, 2021
1 parent 38e1e26 commit a91c1f5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/lib389/lib389/instance/setup.py
Expand Up @@ -540,7 +540,7 @@ def create_from_inf(self, inf_path):
return True

def _prepare_ds(self, general, slapd, backends):

self.log.info("Validate installation settings ...")
assert_c(general['defaults'] is not None, "Configuration defaults in section [general] not found")
self.log.debug("PASSED: using config settings %s" % general['defaults'])
# Validate our arguments.
Expand Down Expand Up @@ -653,9 +653,9 @@ def create_from_args(self, general, slapd, backends=[], extra=None):
Actually does the setup. this is what you want to call as an api.
"""

self.log.debug("START: Starting installation...")
self.log.debug("START: Starting installation ...")
if not self.verbose:
self.log.info("Starting installation...")
self.log.info("Starting installation ...")

# Check we have privs to run
self.log.debug("READY: Preparing installation for %s...", slapd['instance_name'])
Expand All @@ -681,9 +681,9 @@ def create_from_args(self, general, slapd, backends=[], extra=None):

# Call the child api to do anything it needs.
self._install(extra)
self.log.debug("FINISH: Completed installation for %s", slapd['instance_name'])
self.log.debug("FINISH: Completed installation for instance: slapd-%s", slapd['instance_name'])
if not self.verbose:
self.log.info("Completed installation for %s", slapd['instance_name'])
self.log.info("Completed installation for instance: slapd-%s", slapd['instance_name'])

return True

Expand Down Expand Up @@ -761,6 +761,7 @@ def _install_ds(self, general, slapd, backends):
)
file_dse.write(dse_fmt)

self.log.info("Create file system structures ...")
# Create all the needed paths
# we should only need to make bak_dir, cert_dir, config_dir, db_dir, ldif_dir, lock_dir, log_dir, run_dir?
for path in ('backup_dir', 'cert_dir', 'db_dir', 'ldif_dir', 'lock_dir', 'log_dir', 'run_dir'):
Expand Down Expand Up @@ -871,6 +872,7 @@ def _install_ds(self, general, slapd, backends):
tlsdb.reinit()

if slapd['self_sign_cert']:
self.log.info("Create self-signed certificate database ...")
etc_dirsrv_path = os.path.join(slapd['sysconf_dir'], 'dirsrv/')
ssca_path = os.path.join(etc_dirsrv_path, 'ssca/')
ssca = NssSsl(dbpath=ssca_path)
Expand All @@ -897,6 +899,7 @@ def _install_ds(self, general, slapd, backends):

# Do selinux fixups
if general['selinux']:
self.log.info("Perform SELinux labeling ...")
selinux_paths = ('backup_dir', 'cert_dir', 'config_dir', 'db_dir',
'ldif_dir', 'lock_dir', 'log_dir',
'run_dir', 'schema_dir', 'tmp_dir')
Expand Down Expand Up @@ -945,6 +948,7 @@ def _install_ds(self, general, slapd, backends):
# Create the backends as listed
# Load example data if needed.
for backend in backends:
self.log.info(f"Create database backend: {backend['nsslapd-suffix']} ...")
is_sample_entries_in_props = "sample_entries" in backend
create_suffix_entry_in_props = backend.pop('create_suffix_entry', False)
ds_instance.backends.create(properties=backend)
Expand Down Expand Up @@ -999,6 +1003,7 @@ def _install_ds(self, general, slapd, backends):
else:
self.log.debug("Skipping default SASL maps - no backend found!")

self.log.info("Perform post-installation tasks ...")
# Change the root password finally
ds_instance.config.set('nsslapd-rootpw', slapd['root_password'])

Expand Down

0 comments on commit a91c1f5

Please sign in to comment.