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.