From 6d2c45e4477503425597dceff560f5c4c41ae456 Mon Sep 17 00:00:00 2001 From: Chris Archibald Date: Wed, 22 Aug 2018 08:31:57 -0700 Subject: [PATCH] Bug Fixes issue with netapp.py (#44283) * Fix issue --- lib/ansible/module_utils/netapp.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/ansible/module_utils/netapp.py b/lib/ansible/module_utils/netapp.py index d60a91bd1a4..8be3ef87e13 100644 --- a/lib/ansible/module_utils/netapp.py +++ b/lib/ansible/module_utils/netapp.py @@ -27,11 +27,18 @@ # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import json +try: + import json +except ImportError: + import simplejson as json from ansible.module_utils.six.moves.urllib.error import HTTPError from ansible.module_utils.urls import open_url from ansible.module_utils.api import basic_auth_argument_spec +try: + from ansible.module_utils.ansible_release import __version__ as ansible_version +except ImportError: + ansible_version = 'unknown' import os import ssl @@ -137,7 +144,7 @@ def setup_na_ontap_zapi(module, vserver=None): port = 443 transport_type = 'HTTPS' # HACK to bypass certificate verification - if validate_certs is True: + if validate_certs is False: if not os.environ.get('PYTHONHTTPSVERIFY', '') and getattr(ssl, '_create_unverified_context', None): ssl._create_default_https_context = ssl._create_unverified_context else: @@ -226,7 +233,7 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True, return resp_code, data -def ems_log_event(source, server, name="Ansible", id="12345", version="1.1", +def ems_log_event(source, server, name="Ansible", id="12345", version=ansible_version, category="Information", event="setup", autosupport="false"): ems_log = zapi.NaElement('ems-autosupport-log') # Host name invoking the API.