ipatests: Pretty print multihost config

The printing of string representation of multihost config is useless.
For example,
```
<ipatests.pytest_ipa.integration.config.Config object at 0x7fe017d9dc70>
```

The dictionary representation of such looks better:
```
[ipatests.pytest_ipa.integration] {'ad_admin_name': 'Administrator',
 'ad_admin_password': 'Secret123',
 'admin_name': 'admin',
 'admin_password': 'Secret123',
 'dirman_dn': 'cn=Directory Manager',
 'dirman_password': 'Secret123',
 'dns_forwarder': '8.8.8.8',
 'domain_level': 1,
 'domains': [{'hosts': [{'external_hostname': 'master1.ipa.test',
                         'ip': '172.19.0.2',
                         'name': 'master1.ipa.test',
                         'role': 'master'},
                        {'external_hostname': 'replica1.ipa.test',
                         'ip': '172.19.0.3',
                         'name': 'replica1.ipa.test',
                         'role': 'replica'},
...
```

Fixes: https://pagure.io/freeipa/issue/8265
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Stanislav Levin 2020-04-13 13:58:01 +03:00 committed by Christian Heimes
parent 43ac2d9ab3
commit 5da309ee11

View File

@ -21,6 +21,8 @@
from __future__ import print_function, absolute_import
from pprint import pformat
import logging
import os
import tempfile
@ -260,7 +262,8 @@ def mh(request, class_integration_logs):
host.external_hostname, filename)
class_integration_logs.setdefault(host, []).append(filename)
print(mh.config)
if logger.isEnabledFor(logging.INFO):
logger.info(pformat(mh.config.to_dict()))
for host in mh.config.get_all_hosts():
host.add_log_collector(collect_log)
logger.info('Preparing host %s', host.hostname)