提交 10dd8998 编写于 作者: C Cleber Rosa

Sysinfo: make the collection of installed packages configurable

So that users can decide to enable this costly but, depending on
use case, very useful piece of information.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 cd212fd4
......@@ -26,6 +26,7 @@ except ImportError:
from avocado import utils
from avocado.linux import software_manager
from avocado.core import output
from avocado.settings import settings
log = logging.getLogger("avocado.test")
......@@ -324,20 +325,29 @@ class SysInfo(object):
* end_job
"""
def __init__(self, basedir=None, log_packages=False):
def __init__(self, basedir=None, log_packages=None):
"""
Set sysinfo loggables.
:param basedir: Base log dir where sysinfo files will be located.
:param log_packages: Whether to log system packages (optional because
logging packages is a costly operation).
logging packages is a costly operation). If not
given explicitly, tries to look in the config
files, and if not found, defaults to False.
"""
if basedir is None:
basedir = utils.path.init_dir(os.getcwd(), 'sysinfo')
self.basedir = basedir
self.log_packages = log_packages
self._installed_pkgs = None
if log_packages is None:
self.log_packages = settings.get_value('sysinfo.collect',
'installed_packages',
key_type='bool',
default=False)
else:
self.log_packages = log_packages
self.start_job_loggables = set()
self.end_job_loggables = set()
......
......@@ -3,3 +3,6 @@ base_dir = /usr/share/avocado
test_dir = /usr/share/avocado/tests
data_dir = /usr/share/avocado/data
logs_dir = ~/avocado/job-results
[sysinfo.collect]
installed_packages = False
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册