From 6dd1fc6f34dd60e2955e0cc20058d7b43c79f600 Mon Sep 17 00:00:00 2001 From: Damien Date: Fri, 26 May 2017 03:59:51 -0700 Subject: [PATCH] aos_login change default port and add version check (#24752) * Change default port for aos_login and force type to Integer * Add check to make sure aos-pyez is present and has the right version * Update min version requirement in doc * Change default port in documentation as well --- lib/ansible/modules/network/aos/aos_login.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/network/aos/aos_login.py b/lib/ansible/modules/network/aos/aos_login.py index cca320dadbf..f845fa9d074 100644 --- a/lib/ansible/modules/network/aos/aos_login.py +++ b/lib/ansible/modules/network/aos/aos_login.py @@ -37,7 +37,7 @@ description: ansible facts with the variable I(aos_session) This module is not idempotent and do not support check mode. requirements: - - "aos-pyez >= 0.6.0" + - "aos-pyez >= 0.6.1" options: server: description: @@ -46,7 +46,7 @@ options: port: description: - Port number to use when connecting to the AOS server. - default: 8888 + default: 443 user: description: - Login username to use when connecting to the AOS server. @@ -81,6 +81,7 @@ aos_session: ''' from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.aos import check_aos_version try: from apstra.aosom.session import Session @@ -114,7 +115,7 @@ def main(): module = AnsibleModule( argument_spec=dict( server=dict(required=True), - port=dict(default='8888'), + port=dict(default='443', type="int"), user=dict(default='admin'), passwd=dict(default='admin', no_log=True))) @@ -122,6 +123,9 @@ def main(): module.fail_json(msg='aos-pyez is not installed. Please see details ' 'here: https://github.com/Apstra/aos-pyez') + # Check if aos-pyez is present and match the minimum version + check_aos_version(module, '0.6.1') + aos_login(module) if __name__ == '__main__':