Skip to content

Commit

Permalink
Fix RESTCONF media types (ansible#58015)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qalthos authored Jun 19, 2019
1 parent 64d0559 commit f656959
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/58015-yang-types.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- Fix media type of RESTCONF requests.
4 changes: 2 additions & 2 deletions lib/ansible/module_utils/network/restconf/restconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get(module, path=None, content=None, fields=None, output='json'):

accept = None
if output == 'xml':
accept = 'application/yang.data+xml'
accept = 'application/yang-data+xml'

connection = Connection(module._socket_path)
return connection.send_request(None, path=path, method='GET', accept=accept)
Expand All @@ -51,7 +51,7 @@ def edit_config(module, path=None, content=None, method='GET', format='json'):

content_type = None
if format == 'xml':
content_type = 'application/yang.data+xml'
content_type = 'application/yang-data+xml'

connection = Connection(module._socket_path)
return connection.send_request(content, path=path, method=method, content_type=content_type)
2 changes: 1 addition & 1 deletion lib/ansible/plugins/httpapi/restconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from ansible.plugins.httpapi import HttpApiBase


CONTENT_TYPE = 'application/yang.data+json'
CONTENT_TYPE = 'application/yang-data+json'


class HttpApi(HttpApiBase):
Expand Down

0 comments on commit f656959

Please sign in to comment.