Issue 1:
Issue Type:

Bug Report

Ansible Version:

ansible 1.9.4

configured module search path = None

Ansible Configuration:

Nothing

Environment:

Debian 8.2

Python 2.7.9

Summary:

Very similar to #12549

Using a proxy for HTTPS endpoints causes Ansible to complain that the certificate doesn't match the hostname (I added some print statements to the generated python file to reveal that the hostname it tries to compare to is that of the proxy).

It works with Ansible 1.9.2, but not 1.9.3 or 1.9.4.

Steps To Reproduce:

https_proxy=http://10.41.16.10:3128 ansible -m get_url -a "url=https://www.google.com force=yes dest=/dev/null" -i localhost, all -c local -vv

Expected Results:

File is fetched without issue.

Actual Results:

<localhost> REMOTE_MODULE get_url url=https://www.google.com force=yes dest=/dev/null
localhost | FAILED >> {
"failed": true,
"msg": "SSL Certificate does not belong to www.google.com. Make sure the url has a certificate that belongs to it or use validate_certs=False (insecure)"
}

Issue 2:
ISSUE TYPE

Bug Report

COMPONENT NAME

to_nice_json

to_nice_yaml

copy

ANSIBLE VERSION

Latest stable/unstable versions:

ansible 2.4.1.0 (detached HEAD e946c4b3b7) last updated 2017/10/26 19:28:15 (GMT +200)
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/actionmystique/Ansible/git-yang-networkop/ansible-101/library']
ansible python module location = /home/actionmystique/src/Ansible/git-ansible/lib/ansible
executable location = /home/actionmystique/src/Ansible/git-ansible/bin/ansible
python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118]

ansible 2.5.0 (devel 17a008654a) last updated 2017/10/26 18:11:55 (GMT +200)
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/actionmystique/Ansible/git-yang-networkop/ansible-101/library']
ansible python module location = /home/actionmystique/src/Ansible/git-ansible/lib/ansible
executable location = /home/actionmystique/src/Ansible/git-ansible/bin/ansible
python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118]

CONFIGURATION

inventory = ./hosts
library = /home/actionmystique/Ansible/git-yang-networkop/ansible-101/library
forks = 1000
gathering = explicit
gather_timeout = 30
roles_path = /home/actionmystique/Ansible/Roles/roles
private_role_vars = yes
hash_behaviour = merge
log_path = /var/log/ansible.log
retry_files_enabled = False
show_custom_stats = True
timeout = 120
pipelining = True
connect_timeout = 240
connect_retry_timeout = 180

OS / ENVIRONMENT

host: Ubuntu 17.04 4.10

targets:

NX-OSv 9k 7.0(3)I6(1)

CSR 1000v 16.5.1b

paramiko: 2.0.6

SUMMARY

When the json-formatted variable contains newlines, the jinja2 filters work fine with the copy module.

When it doesn't, they don't.

Am I missing something?

STEPS TO REPRODUCE

Role:

- name: Saving "{{ objects }}" into local YAML file
local_action: >
copy content={{ data.content | from_json | to_nice_yaml }}
dest={{ dest_file }}
mode=0660
when: (data.content is defined) and (format == 'yml')

- name: Saving "{{ objects }}" into local JSON file
local_action: >
copy content={{ data.content | from_json | to_nice_json }}
dest={{ dest_file }}
mode=0660
when: (data.content is defined) and (format == 'json')

Json-formatted data with newlines and spaces: (from CSR 1000v)

"data": {
...
"content": "{\n \"ietf-interfaces:interfaces-state\": {\n \"interface\": [\n {\n \"name\": \"GigabitEthernet1\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"admin-status\": \"up\",\n \"oper-status\": \"up\",\n \"last-change\": \"2017-10-26T13:24:45.000772+00:00\",\n \"if-index\": 0,\n \"phys-address\": \"00:00:16:05:01:32\",\n \"speed\": 1024000000,\n \"statistics\": {\n \"discontinuity-time\": \"2017-10-26T13:22:12.000505+00:00\",\n \"in-octets\": 519892,\n \"in-unicast-pkts\": 6508,\n \"in-broadcast-pkts\": 0,\n \"in-multicast-pkts\": 5939,\n \"in-discards\": 0,\n \"in-errors\": 0,\n \"in-unknown-protos\": 0,\n \"out-octets\": 1070413,\n \"out-unicast-pkts\": 2722,\n \"out-broadcast-pkts\": 0,\n \"out-multicast-pkts\": 0,\n \"out-discards\": 0,\n \"out-errors\": 0\n }\n },\n {\n \"name\": \"GigabitEthernet2\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"admin-status\": \"down\",\n \"oper-status\": \"down\",\n \"last-change\": \"2017-10-26T13:24:36.000962+00:00\",\n \"if-index\": 0,\n \"phys-address\": \"00:00:16:05:01:33\",\n \"speed\": 1024000000,\n \"statistics\": {\n \"discontinuity-time\": \"2017-10-26T13:22:12.000499+00:00\",\n \"in-octets\": 0,\n \"in-unicast-pkts\": 0,\n \"in-broadcast-pkts\": 0,\n \"in-multicast-pkts\": 0,\n \"in-discards\": 0,\n \"in-errors\": 0,\n \"in-unknown-protos\": 0,\n \"out-octets\": 238,\n \"out-unicast-pkts\": 3,\n \"out-broadcast-pkts\": 0,\n \"out-multicast-pkts\": 0,\n \"out-discards\": 0,\n \"out-errors\": 0\n }\n },\n {\n \"name\": \"GigabitEthernet3\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"admin-status\": \"down\",\n \"oper-status\": \"down\",\n \"last-change\": \"2017-10-26T13:24:37.000001+00:00\",\n \"if-index\": 0,\n \"phys-address\": \"00:00:16:05:01:34\",\n \"speed\": 1024000000,\n \"statistics\": {\n \"discontinuity-time\": \"2017-10-26T13:22:12.000497+00:00\",\n \"in-octets\": 0,\n \"in-unicast-pkts\": 0,\n \"in-broadcast-pkts\": 0,\n \"in-multicast-pkts\": 0,\n \"in-discards\": 0,\n \"in-errors\": 0,\n \"in-unknown-protos\": 0,\n \"out-octets\": 238,\n \"out-unicast-pkts\": 3,\n \"out-broadcast-pkts\": 0,\n \"out-multicast-pkts\": 0,\n \"out-discards\": 0,\n \"out-errors\": 0\n }\n },\n {\n \"name\": \"GigabitEthernet4\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"admin-status\": \"down\",\n \"oper-status\": \"down\",\n \"last-change\": \"2017-10-26T13:24:37.000048+00:00\",\n \"if-index\": 0,\n \"phys-address\": \"00:00:16:05:01:35\",\n \"speed\": 1024000000,\n \"statistics\": {\n \"discontinuity-time\": \"2017-10-26T13:22:12.000497+00:00\",\n \"in-octets\": 0,\n \"in-unicast-pkts\": 0,\n \"in-broadcast-pkts\": 0,\n \"in-multicast-pkts\": 0,\n \"in-discards\": 0,\n \"in-errors\": 0,\n \"in-unknown-protos\": 0,\n \"out-octets\": 238,\n \"out-unicast-pkts\": 3,\n \"out-broadcast-pkts\": 0,\n \"out-multicast-pkts\": 0,\n \"out-discards\": 0,\n \"out-errors\": 0\n }\n },\n {\n \"name\": \"GigabitEthernet5\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"admin-status\": \"down\",\n \"oper-status\": \"down\",\n \"last-change\": \"2017-10-26T13:24:37.000088+00:00\",\n \"if-index\": 0,\n \"phys-address\": \"00:00:16:05:01:36\",\n \"speed\": 1024000000,\n \"statistics\": {\n \"discontinuity-time\": \"2017-10-26T13:22:12.000497+00:00\",\n \"in-octets\": 0,\n \"in-unicast-pkts\": 0,\n \"in-broadcast-pkts\": 0,\n \"in-multicast-pkts\": 0,\n \"in-discards\": 0,\n \"in-errors\": 0,\n \"in-unknown-protos\": 0,\n \"out-octets\": 238,\n \"out-unicast-pkts\": 3,\n \"out-broadcast-pkts\": 0,\n \"out-multicast-pkts\": 0,\n \"out-discards\": 0,\n \"out-errors\": 0\n }\n },\n {\n \"name\": \"GigabitEthernet6\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"admin-status\": \"down\",\n \"oper-status\": \"down\",\n \"last-change\": \"2017-10-26T13:24:37.000128+00:00\",\n \"if-index\": 0,\n \"phys-address\": \"00:00:16:05:01:37\",\n \"speed\": 1024000000,\n \"statistics\": {\n \"discontinuity-time\": \"2017-10-26T13:22:12.000497+00:00\",\n \"in-octets\": 0,\n \"in-unicast-pkts\": 0,\n \"in-broadcast-pkts\": 0,\n \"in-multicast-pkts\": 0,\n \"in-discards\": 0,\n \"in-errors\": 0,\n \"in-unknown-protos\": 0,\n \"out-octets\": 238,\n \"out-unicast-pkts\": 3,\n \"out-broadcast-pkts\": 0,\n \"out-multicast-pkts\": 0,\n \"out-discards\": 0,\n \"out-errors\": 0\n }\n },\n {\n \"name\": \"GigabitEthernet7\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"admin-status\": \"down\",\n \"oper-status\": \"down\",\n \"last-change\": \"2017-10-26T13:24:37.000168+00:00\",\n \"if-index\": 0,\n \"phys-address\": \"00:00:16:05:01:38\",\n \"speed\": 1024000000,\n \"statistics\": {\n \"discontinuity-time\": \"2017-10-26T13:22:12.000497+00:00\",\n \"in-octets\": 0,\n \"in-unicast-pkts\": 0,\n \"in-broadcast-pkts\": 0,\n \"in-multicast-pkts\": 0,\n \"in-discards\": 0,\n \"in-errors\": 0,\n \"in-unknown-protos\": 0,\n \"out-octets\": 238,\n \"out-unicast-pkts\": 3,\n \"out-broadcast-pkts\": 0,\n \"out-multicast-pkts\": 0,\n \"out-discards\": 0,\n \"out-errors\": 0\n }\n },\n {\n \"name\": \"GigabitEthernet8\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"admin-status\": \"down\",\n \"oper-status\": \"down\",\n \"last-change\": \"2017-10-26T13:24:37.000208+00:00\",\n \"if-index\": 0,\n \"phys-address\": \"00:00:16:05:01:39\",\n \"speed\": 1024000000,\n \"statistics\": {\n \"discontinuity-time\": \"2017-10-26T13:22:12.000497+00:00\",\n \"in-octets\": 0,\n \"in-unicast-pkts\": 0,\n \"in-broadcast-pkts\": 0,\n \"in-multicast-pkts\": 0,\n \"in-discards\": 0,\n \"in-errors\": 0,\n \"in-unknown-protos\": 0,\n \"out-octets\": 238,\n \"out-unicast-pkts\": 3,\n \"out-broadcast-pkts\": 0,\n \"out-multicast-pkts\": 0,\n \"out-discards\": 0,\n \"out-errors\": 0\n }\n }\n ]\n }\n}\n",
"content_type": "application/vnd.yang.data+json",
...
}

Json-formatted data without newlines and spaces: (from NX-OSv 9k)

"data": {
...
"content": "{\"interfaces\":{\"interface\":{\"config\":{\"name\":\"vlan1\"},\"name\":\"vlan1\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/39\"},\"name\":\"eth1\\/39\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/48\"},\"name\":\"eth1\\/48\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/42\"},\"name\":\"eth1\\/42\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/37\"},\"name\":\"eth1\\/37\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/35\"},\"name\":\"eth1\\/35\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/27\"},\"name\":\"eth1\\/27\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/3\"},\"name\":\"eth1\\/3\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\",\"ipv4\":{\"addresses\":{\"address\":{\"config\":{\"ip\":\"10.3.112.11\",\"prefix-length\":\"24\"},\"ip\":\"10.3.112.11\"}}}}},\"routed-vlan\":{\"ipv4\":{\"addresses\":{\"address\":{\"config\":{\"ip\":\"10.3.112.11\",\"prefix-length\":\"24\"},\"ip\":\"10.3.112.11\"}}}}},\"interface\":{\"config\":{\"name\":\"eth1\\/52\"},\"name\":\"eth1\\/52\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/54\"},\"name\":\"eth1\\/54\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/61\"},\"name\":\"eth1\\/61\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/58\"},\"name\":\"eth1\\/58\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/4\"},\"name\":\"eth1\\/4\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\",\"ipv4\":{\"addresses\":{\"address\":{\"config\":{\"ip\":\"10.3.113.11\",\"prefix-length\":\"24\"},\"ip\":\"10.3.113.11\"}}}},\"subinterface\":{\"index\":\"20\"},\"subinterface\":{\"index\":\"10\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/29\"},\"name\":\"eth1\\/29\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/47\"},\"name\":\"eth1\\/47\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/14\"},\"name\":\"eth1\\/14\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/9\"},\"name\":\"eth1\\/9\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/7\"},\"name\":\"eth1\\/7\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\",\"ipv4\":{\"addresses\":{\"address\":{\"config\":{\"ip\":\"10.3.116.11\",\"prefix-length\":\"24\"},\"ip\":\"10.3.116.11\"}}}},\"subinterface\":{\"index\":\"20\"},\"subinterface\":{\"index\":\"10\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/8\"},\"name\":\"eth1\\/8\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/25\"},\"name\":\"eth1\\/25\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/18\"},\"name\":\"eth1\\/18\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/40\"},\"name\":\"eth1\\/40\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/12\"},\"name\":\"eth1\\/12\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/36\"},\"name\":\"eth1\\/36\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/16\"},\"name\":\"eth1\\/16\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/1\"},\"name\":\"eth1\\/1\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\",\"ipv4\":{\"addresses\":{\"address\":{\"config\":{\"ip\":\"172.21.100.111\",\"prefix-length\":\"16\"},\"ip\":\"172.21.100.111\"}}}}},\"routed-vlan\":{\"ipv4\":{\"addresses\":{\"address\":{\"config\":{\"ip\":\"172.21.100.111\",\"prefix-length\":\"16\"},\"ip\":\"172.21.100.111\"}}}}},\"interface\":{\"config\":{\"name\":\"eth1\\/10\"},\"name\":\"eth1\\/10\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/49\"},\"name\":\"eth1\\/49\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/31\"},\"name\":\"eth1\\/31\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/53\"},\"name\":\"eth1\\/53\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/19\"},\"name\":\"eth1\\/19\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/38\"},\"name\":\"eth1\\/38\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/56\"},\"name\":\"eth1\\/56\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/43\"},\"name\":\"eth1\\/43\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/44\"},\"name\":\"eth1\\/44\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/5\"},\"name\":\"eth1\\/5\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\",\"ipv4\":{\"addresses\":{\"address\":{\"config\":{\"ip\":\"10.3.114.11\",\"prefix-length\":\"24\"},\"ip\":\"10.3.114.11\"}}}},\"subinterface\":{\"index\":\"10\"},\"subinterface\":{\"index\":\"20\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/34\"},\"name\":\"eth1\\/34\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/23\"},\"name\":\"eth1\\/23\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/21\"},\"name\":\"eth1\\/21\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/28\"},\"name\":\"eth1\\/28\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/22\"},\"name\":\"eth1\\/22\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/24\"},\"name\":\"eth1\\/24\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/55\"},\"name\":\"eth1\\/55\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/33\"},\"name\":\"eth1\\/33\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/11\"},\"name\":\"eth1\\/11\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/64\"},\"name\":\"eth1\\/64\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/41\"},\"name\":\"eth1\\/41\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/13\"},\"name\":\"eth1\\/13\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/45\"},\"name\":\"eth1\\/45\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/2\"},\"name\":\"eth1\\/2\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\",\"ipv4\":{\"addresses\":{\"address\":{\"config\":{\"ip\":\"10.3.111.11\",\"prefix-length\":\"24\"},\"ip\":\"10.3.111.11\"}}}}},\"routed-vlan\":{\"ipv4\":{\"addresses\":{\"address\":{\"config\":{\"ip\":\"10.3.111.11\",\"prefix-length\":\"24\"},\"ip\":\"10.3.111.11\"}}}}},\"interface\":{\"config\":{\"name\":\"eth1\\/63\"},\"name\":\"eth1\\/63\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/60\"},\"name\":\"eth1\\/60\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/62\"},\"name\":\"eth1\\/62\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/17\"},\"name\":\"eth1\\/17\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/59\"},\"name\":\"eth1\\/59\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/46\"},\"name\":\"eth1\\/46\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/50\"},\"name\":\"eth1\\/50\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/20\"},\"name\":\"eth1\\/20\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/57\"},\"name\":\"eth1\\/57\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/6\"},\"name\":\"eth1\\/6\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\",\"ipv4\":{\"addresses\":{\"address\":{\"config\":{\"ip\":\"10.3.115.11\",\"prefix-length\":\"24\"},\"ip\":\"10.3.115.11\"}}}},\"subinterface\":{\"index\":\"20\"},\"subinterface\":{\"index\":\"10\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/26\"},\"name\":\"eth1\\/26\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/51\"},\"name\":\"eth1\\/51\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/15\"},\"name\":\"eth1\\/15\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/32\"},\"name\":\"eth1\\/32\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"interface\":{\"config\":{\"name\":\"eth1\\/30\"},\"name\":\"eth1\\/30\",\"subinterfaces\":{\"subinterface\":{\"index\":\"0\"}}},\"xmlns\":\"http:\\/\\/openconfig.net\\/yang\\/interfaces\"}}",
"content_length": "8414",
"content_type": "application/yang.data+json",
...
}

EXPECTED RESULTS

Both json-formatted data should be converted correctly.

ACTUAL RESULTS: to_nice_yaml from json-formatted data with newlines and spaces

ietf-interfaces:interfaces-state:
interface:
- admin-status: up
if-index: 0
last-change: '2017-10-26T13:24:45.000772+00:00'
name: GigabitEthernet1
oper-status: up
phys-address: 00:00:16:05:01:32
speed: 1024000000
statistics:
discontinuity-time: '2017-10-26T13:22:12.000505+00:00'
in-broadcast-pkts: 0
in-discards: 0
in-errors: 0
in-multicast-pkts: 5939
in-octets: 519892
in-unicast-pkts: 6508
in-unknown-protos: 0
out-broadcast-pkts: 0
out-discards: 0
out-errors: 0
out-multicast-pkts: 0
out-octets: 1070413
out-unicast-pkts: 2722
type: iana-if-type:ethernetCsmacd
- admin-status: down
if-index: 0
last-change: '2017-10-26T13:24:36.000962+00:00'
name: GigabitEthernet2
oper-status: down
phys-address: 00:00:16:05:01:33
speed: 1024000000
statistics:
discontinuity-time: '2017-10-26T13:22:12.000499+00:00'
in-broadcast-pkts: 0
in-discards: 0
in-errors: 0
in-multicast-pkts: 0
in-octets: 0
in-unicast-pkts: 0
in-unknown-protos: 0
out-broadcast-pkts: 0
out-discards: 0
out-errors: 0
out-multicast-pkts: 0
out-octets: 238
out-unicast-pkts: 3
type: iana-if-type:ethernetCsmacd
...

ACTUAL RESULTS: to_nice_yaml from json-formatted data without newlines and spaces

interfaces:
interface:
config:
name: eth1/30
name: eth1/30
subinterfaces:
subinterface:
index: '0'
xmlns: http://openconfig.net/yang/interfaces