This is an automated email from the git hooks/post-receive script.
mhonek pushed a commit to branch 389-ds-base-1.4.2
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.2 by this push:
new 1d8eb25 Issue 50640 - Database links: get_monitor() takes 1 positional argument but 2 were given
1d8eb25 is described below
commit 1d8eb25b9b2dd68f6739269318b88c71505534af
Author: Matus Honek <mhonek@redhat.com>
AuthorDate: Fri Mar 27 04:36:09 2020 +0000
Issue 50640 - Database links: get_monitor() takes 1 positional argument but 2 were given
Bug Description:
Cannot call dsconf ... chaining monitor due to invalid call to get_monitor.
FTR: The other issue reported within, for the ... link-delete has already been
fixed in commit c403a39.
Fix Description:
Use _get_link to get the named link, the same way some other functions in the
file do.
Also, merge and move _format_status to cli_base.
Fixes https://pagure.io/389-ds-base/issue/50640
Author: Matus Honek <mhonek@redhat.com>
Review by: Mark (thanks!)
(cherry picked from commit f31abde7da3a941147b3dfea032bbbc60305b87f)
---
src/lib389/lib389/cli_base/__init__.py | 12 ++++++++++++
src/lib389/lib389/cli_conf/backend.py | 13 +------------
src/lib389/lib389/cli_conf/chaining.py | 7 ++++---
src/lib389/lib389/cli_conf/monitor.py | 13 +------------
4 files changed, 18 insertions(+), 27 deletions(-)
diff --git a/src/lib389/lib389/cli_base/__init__.py b/src/lib389/lib389/cli_base/__init__.py
index 92b5640..9a3706f 100644
--- a/src/lib389/lib389/cli_base/__init__.py
+++ b/src/lib389/lib389/cli_base/__init__.py
@@ -165,6 +165,18 @@ def populate_attr_arguments(parser, attributes):
parser.add_argument('--%s' % attr, nargs='?', help="Value of %s" % attr)
+def _format_status(log, mtype, json=False):
+ if json:
+ print(mtype.get_status_json())
+ else:
+ status_dict = mtype.get_status()
+ log.info('dn: ' + mtype._dn)
+ for k, v in list(status_dict.items()):
+ # For each value in the multivalue attr
+ for vi in v:
+ log.info('{}: {}'.format(k, vi))
+
+
def _generic_list(inst, basedn, log, manager_class, args=None):
mc = manager_class(inst, basedn)
ol = mc.list()
diff --git a/src/lib389/lib389/cli_conf/backend.py b/src/lib389/lib389/cli_conf/backend.py
index 75dfc5f..39f4e92 100644
--- a/src/lib389/lib389/cli_conf/backend.py
+++ b/src/lib389/lib389/cli_conf/backend.py
@@ -21,6 +21,7 @@ from lib389.replica import Replicas
from lib389.utils import ensure_str, is_a_dn, is_dn_parent
from lib389._constants import *
from lib389.cli_base import (
+ _format_status,
_generic_get,
_generic_get_dn,
_get_arg,
@@ -507,18 +508,6 @@ def db_config_set(inst, basedn, log, args):
log.info("Successfully updated database configuration")
-def _format_status(log, mtype, json=False):
- if json:
- log.info(mtype.get_status_json())
- else:
- status_dict = mtype.get_status()
- log.info('dn: ' + mtype._dn)
- for k, v in list(status_dict.items()):
- # For each value in the multivalue attr
- for vi in v:
- log.info('{}: {}'.format(k, vi))
-
-
def get_monitor(inst, basedn, log, args):
if args.suffix is not None:
# Get a suffix/backend monitor entry
diff --git a/src/lib389/lib389/cli_conf/chaining.py b/src/lib389/lib389/cli_conf/chaining.py
index 7c93eb3..5125898 100644
--- a/src/lib389/lib389/cli_conf/chaining.py
+++ b/src/lib389/lib389/cli_conf/chaining.py
@@ -14,6 +14,7 @@ from lib389.cli_base import (
_generic_get,
_get_arg,
)
+from lib389.cli_conf.monitor import _format_status
arg_to_attr = {
'conn_bind_limit': 'nsbindconnectionslimit',
@@ -197,10 +198,10 @@ def delete_link(inst, basedn, log, args, warn=True):
def monitor_link(inst, basedn, log, args):
- chain_link = ChainingLink(inst)
- monitor = chain_link.get_monitor(args.CHAIN_NAME[0])
+ chain_link = _get_link(inst, args.CHAIN_NAME[0])
+ monitor = chain_link.get_monitor()
if monitor is not None:
- monitor.get_status(use_json=args.json)
+ _format_status(log, monitor, args.json)
else:
raise ValueError("There was no monitor found for link '{}'".format(args.CHAIN_NAME[0]))
diff --git a/src/lib389/lib389/cli_conf/monitor.py b/src/lib389/lib389/cli_conf/monitor.py
index 19806e5..38490c6 100644
--- a/src/lib389/lib389/cli_conf/monitor.py
+++ b/src/lib389/lib389/cli_conf/monitor.py
@@ -12,18 +12,7 @@ from lib389.monitor import (Monitor, MonitorLDBM, MonitorSNMP, MonitorDiskSpace)
from lib389.chaining import (ChainingLinks)
from lib389.backend import Backends
from lib389.utils import convert_bytes
-
-
-def _format_status(log, mtype, json=False):
- if json:
- print(mtype.get_status_json())
- else:
- status_dict = mtype.get_status()
- log.info('dn: ' + mtype._dn)
- for k, v in list(status_dict.items()):
- # For each value in the multivalue attr
- for vi in v:
- log.info('{}: {}'.format(k, vi))
+from lib389.cli_base import _format_status
def monitor(inst, basedn, log, args):
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
389-commits mailing list -- 389-commits@lists.fedoraproject.org
To unsubscribe send an email to 389-commits-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/389-commits@lists.fedoraproject.org
No comments:
Post a Comment