diff options
author | Bradley A. Thornton <bthornto@thethorntons.net> | 2019-08-09 10:48:27 -0700 |
---|---|---|
committer | Bradley A. Thornton <bthornto@thethorntons.net> | 2019-08-09 10:48:27 -0700 |
commit | 5fb9df4e907a6ab2da7a6c2dafdec9c1971e8d44 (patch) | |
tree | 4459ed61d06c8d8caabbcc3ab36d84e27a919ee7 /plugins/modules/vyos_ping.py | |
parent | 7b9a33a29007ed302c3001566061e22c514cde64 (diff) | |
download | vyos.vyos-5fb9df4e907a6ab2da7a6c2dafdec9c1971e8d44.tar.gz vyos.vyos-5fb9df4e907a6ab2da7a6c2dafdec9c1971e8d44.zip |
bt_blackked
Diffstat (limited to 'plugins/modules/vyos_ping.py')
-rw-r--r-- | plugins/modules/vyos_ping.py | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/plugins/modules/vyos_ping.py b/plugins/modules/vyos_ping.py index f5657ffe..9e99d488 100644 --- a/plugins/modules/vyos_ping.py +++ b/plugins/modules/vyos_ping.py @@ -20,12 +20,13 @@ # from __future__ import absolute_import, division, print_function + __metaclass__ = type ANSIBLE_METADATA = { - 'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community' + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", } DOCUMENTATION = """ @@ -132,11 +133,13 @@ rtt: """ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.vyos.vyos.plugins.module_utils.network. \ - vyos.vyos import run_commands +from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import ( + run_commands, +) -from ansible_collections.vyos.vyos.plugins.module_utils.network. \ - vyos.vyos import vyos_argument_spec +from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import ( + vyos_argument_spec, +) import re @@ -148,12 +151,10 @@ def main(): count=dict(type="int", default=5), dest=dict(type="str", required=True), source=dict(type="str"), - ttl=dict(type='int'), - size=dict(type='int'), - interval=dict(type='int'), - state=dict(type="str", - choices=["absent", "present"], - default="present"), + ttl=dict(type="int"), + size=dict(type="int"), + interval=dict(type="int"), + state=dict(type="str", choices=["absent", "present"], default="present"), ) argument_spec.update(vyos_argument_spec) @@ -173,18 +174,16 @@ def main(): if warnings: results["warnings"] = warnings - results["commands"] = [ - build_ping(dest, count, size, interval, source, ttl) - ] + results["commands"] = [build_ping(dest, count, size, interval, source, ttl)] ping_results = run_commands(module, commands=results["commands"]) ping_results_list = ping_results[0].split("\n") rtt_info, rate_info = None, None for line in ping_results_list: - if line.startswith('rtt'): + if line.startswith("rtt"): rtt_info = line - if line.startswith('%s packets transmitted' % count): + if line.startswith("%s packets transmitted" % count): rate_info = line if rtt_info: |