##### SUMMARY
The `nios_a_record` module updates values on existing records when in `--check` mode.

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
`nios`
`nios_a_record`

##### ANSIBLE VERSION
```
$ ansible --version
ansible 2.9.4
  config file = /var/lib/jenkins/workspace/zure-infoblox-dns_initial_create/ansible.cfg
  configured module search path = [u'/var/lib/jenkins/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
```

##### CONFIGURATION
```
$ ansible-config dump --only-changed
DEFAULT_STDOUT_CALLBACK(/var/lib/jenkins/workspace/zure-infoblox-dns_initial_create/ansible.cfg) = yaml
```

##### OS / ENVIRONMENT
Red Hat Enterprise Linux 7.7
Infoblox 8.3.4-381259
```
$ pip show infoblox-client
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Name: infoblox-client
Version: 0.4.23
Summary: Client for interacting with Infoblox NIOS over WAPI
Home-page: https://github.com/infobloxopen/infoblox-client
Author: John Belamaric
Author-email: jbelamaric@infoblox.com
License: Apache
Location: /usr/lib/python2.7/site-packages
Requires: urllib3, setuptools, oslo.log, requests, oslo.serialization
Required-by: 

```

##### STEPS TO REPRODUCE
There is a host record named test.example.com already present in Infoblox, with no comment. Ansible-playbook is run in `--check` mode to validate what would be changed.

```
ansible-playbook --check main.yml
```

```yaml
---
- hosts: localhost
  gather_facts: false
  connection: local

  tasks:
  - name: Manage A Record
    nios_a_record:
      comment: "Test"
      ipv4addr: "10.10.1.1"
      name: "test.example.com"
      provider: "{{ nios_provider }}"
```

##### EXPECTED RESULTS
Task shows 'changed' but no data is changed.


##### ACTUAL RESULTS
The comment of the existing record is changed to 'Test'.

```
$ ansible-playbook --check main.yml

PLAY [localhost] ***************************************************************

TASK [Manage A Record] ********************************************************
changed: [localhost] 

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
```

''' Transforms the member module arguments into a valid WAPI struct
    This function will transform the arguments into a structure that
    is a valid WAPI structure in the format of:
        {
            key: <value>,
        }
    It will remove any arguments that are set to None since WAPI will error on
    that condition.
    The remainder of the value validation is performed by WAPI
    Some parameters in ib_spec are passed as a list in order to pass the validation for elements.
    In this function, they are converted to dictionary.
    '''
    member_elements = ['vip_setting', 'ipv6_setting', 'lan2_port_setting', 'mgmt_port_setting',
                       'pre_provisioning', 'network_setting', 'v6_network_setting',
                       'ha_port_setting', 'lan_port_setting', 'lan2_physical_setting',
                       'lan_ha_port_setting', 'mgmt_network_setting', 'v6_mgmt_network_setting']
    for key in member_spec.keys():
        if key in member_elements and member_spec[key] is not None:
            member_spec[key] = member_spec[key][0]
        if isinstance(member_spec[key], dict):
            member_spec[key] = member_normalize(member_spec[key])
        elif isinstance(member_spec[key], list):
            for x in member_spec[key]:
                if isinstance(x, dict):
                    x = member_normalize(x)
        elif member_spec[key] is None:
            del member_spec[key]
    return member_spec
class WapiBase(object):