Repository: ansible/ansible

Issue:
gather facts: "Invocation had junk after JSON data" since 841cb0e
##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
gather_facts 

##### ANSIBLE VERSION

```
ansible 2.6.0 (detached HEAD 841cb0e6a4) last updated 2018/03/15 09:45:24 (GMT +200)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/marcel/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/marcel/Sources/github/ansible/lib/ansible
  executable location = /home/marcel/Sources/github/ansible/bin/ansible
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]
```

##### CONFIGURATION
No deviations from the default configuration. 

##### OS / ENVIRONMENT
N/A

##### SUMMARY
Gathering Facts throws a Warning which says "[WARNING]: Module invocation had junk after the JSON data: TypeError("'str' object does not support item assignment",)" since 841cb0e. 
I ran the playbook with -vv and the JSON that is shown there looks fine and is a valid json which can be parsed by the Python json module or jq for example. So I don't see the "junk" there. 

##### STEPS TO REPRODUCE
```yaml
---
- hosts: all
  tasks: 
    - name: setup & debug vars 
      debug:
        msg: "cores {{ (ansible_processor_vcpus-2) }}"
```

The inventory looks like this and there are no host or group vars used: 
```yaml
[local]
mwdo-stage-08
``` 

Playbook command: 
```
ANSIBLE_NOCOWS=1 ansible-playbook setup-test-playbook.yml -i inv -u xxx --extra-vars "ansible_python_interpreter=/usr/bin/python3"
```

##### EXPECTED RESULTS
Expected result should look like this: 
```
PLAY [all] *********************************************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************************************************
ok: [mwdo-stage-08]

TASK [setup & debug vars] *********************************************************************************************************************************
ok: [mwdo-stage-08] => {
    "msg": "cores 0"
}

PLAY RECAP *********************************************************************************************************************************
mwdo-stage-08              : ok=2    changed=0    unreachable=0    failed=0   
```

##### ACTUAL RESULTS
```
ANSIBLE_NOCOWS=1 ansible-playbook setup-test-playbook.yml -i inv -u myUser --extra-vars "ansible_python_interpreter=/usr/bin/python3" 

PLAY [all] *********************************************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************************************************
 [WARNING]: Module invocation had junk after the JSON data: TypeError("'str' object does not support item assignment",)

ok: [mwdo-stage-08]

TASK [setup & debug vars] *********************************************************************************************************************************
ok: [mwdo-stage-08] => {
    "msg": "cores 0"
}

PLAY RECAP *********************************************************************************************************************************
mwdo-stage-08              : ok=2    changed=0    unreachable=0    failed=0   
```

So, the playbook itself works fine and the result is ok but the Warning should not appear. 



Discussion:
Files identified in the description:
None

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
!component=lib/ansible/module_utils/facts/compat.py
Files identified in the description:
* [lib/ansible/module_utils/facts/compat.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/compat.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
Same here.  I'm suppressing the issue with:

[ssh_connection]
pipelining = True



Resolving patch:
diff --git a/lib/ansible/module_utils/facts/network/iscsi.py b/lib/ansible/module_utils/facts/network/iscsi.py
--- a/lib/ansible/module_utils/facts/network/iscsi.py
+++ b/lib/ansible/module_utils/facts/network/iscsi.py
@@ -52,7 +52,7 @@ def collect(self, module=None, collected_facts=None):
         num_cmd_elems  200                           Maximum number of commands to queue to driver True
         """
 
-        iscsi_facts = ""
+        iscsi_facts = {}
         iscsi_facts['iscsi_iqn'] = ""
         if sys.platform.startswith('linux') or sys.platform.startswith('sunos'):
             for line in get_file_content('/etc/iscsi/initiatorname.iscsi', '').splitlines():


Test patch: