From c72ed24f8438da6bb8efa8491363490f6b1bf491 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Tue, 25 Jun 2019 19:56:17 +0500 Subject: [PATCH] Improve debugging logging while fetching plugins This commit adds more debugging output while fetching a plugin. --- iocage_lib/ioc_create.py | 4 ++++ iocage_lib/ioc_plugin.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/iocage_lib/ioc_create.py b/iocage_lib/ioc_create.py index 794ceddd1..abb4069b0 100644 --- a/iocage_lib/ioc_create.py +++ b/iocage_lib/ioc_create.py @@ -23,6 +23,7 @@ # POSSIBILITY OF SUCH DAMAGE. """iocage create module.""" import json +import logging import os import pathlib import re @@ -73,6 +74,7 @@ def __init__(self, release, props, num, pkglist=None, plugin=False, self.callback = callback self.zfs = libzfs.ZFS(history=True, history_prefix="") self.thickconfig = thickconfig + self.log = logging.getLogger('iocage') if basejail and not clone_basejail: # We want these thick to remove any odd dependency chains later @@ -843,6 +845,8 @@ def create_install_packages(self, jail_uuid, location, stderr=su.STDOUT) pkg_err = pkg_install.returncode + self.log.debug(pkg_install.stdout) + if pkg_err == 0: break diff --git a/iocage_lib/ioc_plugin.py b/iocage_lib/ioc_plugin.py index 7befa581f..5035c4efd 100644 --- a/iocage_lib/ioc_plugin.py +++ b/iocage_lib/ioc_plugin.py @@ -27,6 +27,7 @@ import datetime import distutils.dir_util import json +import logging import os import git import pathlib @@ -74,6 +75,7 @@ def __init__(self, release=None, jail=None, plugin=None, branch=None, self.callback = callback self.keep_jail_on_failure = keep_jail_on_failure self.thickconfig = kwargs.pop('thickconfig', False) + self.log = logging.getLogger('iocage') if self.branch is None and not self.hardened: freebsd_version = su.run(['freebsd-version'], @@ -199,6 +201,7 @@ def fetch_plugin(self, props, num, accept_license): _json = f"{self.iocroot}/.plugin_index/{self.plugin}.json" if not \ self.plugin.endswith(".json") else self.plugin plugins = self.fetch_plugin_index(props, index_only=True) + self.log.debug(f'Plugin json file path: {_json}') try: with open(_json, "r") as j: @@ -505,6 +508,7 @@ def __fetch_plugin_install_packages__(self, jaildir, conf, pkg_repos, secure = True if "https://" in conf["packagesite"] else False for kmod in kmods: + self.log.debug(f'Loading {kmod}') try: su.check_call( ["kldload", "-n", kmod], stdout=su.PIPE, stderr=su.PIPE)