From ef4cbc3e0c2136417cf5b8b9a7ffdeaa030fe1d0 Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Thu, 25 Jun 2026 15:06:28 +0800 Subject: [PATCH] perf: use mongo ping --- utils/mongodb_ping.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/mongodb_ping.py b/utils/mongodb_ping.py index a4fb906d3..647974644 100644 --- a/utils/mongodb_ping.py +++ b/utils/mongodb_ping.py @@ -49,7 +49,6 @@ conn_err_msg: sample: '' ''' - from pymongo.errors import PyMongoError from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native @@ -116,11 +115,14 @@ def main(): try: client.close() - except Exception: # noqa + except Exception: # noqa pass return module.exit_json(**result) +''' +python3 mongodb_ping.py --host 172.16.10.180 --port 27017 --user root --password 'Calong@2015' --database root +''' if __name__ == '__main__': main()