Browse Source

Set content-type for SoftwareConfig's heat-config-notify

What the heat-config-notify actually POSTs/PUTs to heat is JSON, so
the content-type should be updated as such.

Change-Id: I85e116bec524ba37e96c5761346084ab149601cc
Related-Bug: #1641589
changes/21/416921/1
Juan Antonio Osorio Robles 5 years ago
committed by Thomas Herve
parent
commit
e8e15adba9
  1. 4
      hot/software-config/elements/heat-config/bin/heat-config-notify
  2. 8
      tests/software_config/test_heat_config_notify.py

4
hot/software-config/elements/heat-config/bin/heat-config-notify

@ -107,10 +107,10 @@ def main(argv=sys.argv, stdin=sys.stdin):
str_signal_data = trim_response(signal_data)
if sigverb == 'PUT':
r = requests.put(sigurl, data=str_signal_data,
headers={'content-type': None})
headers={'content-type': 'application/json'})
else:
r = requests.post(sigurl, data=str_signal_data,
headers={'content-type': None})
headers={'content-type': 'application/json'})
log.debug('Response %s ' % r)
if 'deploy_queue_id' in iv:

8
tests/software_config/test_heat_config_notify.py

@ -118,7 +118,7 @@ class HeatConfigNotifyTest(common.RunScriptTest):
requests.post.assert_called_once_with(
'mock://192.0.2.3/foo',
data=signal_data,
headers={'content-type': None})
headers={'content-type': 'application/json'})
def test_notify_signal_id_put(self):
requests = mock.MagicMock()
@ -136,7 +136,7 @@ class HeatConfigNotifyTest(common.RunScriptTest):
requests.put.assert_called_once_with(
'mock://192.0.2.3/foo',
data=signal_data,
headers={'content-type': None})
headers={'content-type': 'application/json'})
def test_notify_signal_id_empty_data(self):
requests = mock.MagicMock()
@ -153,7 +153,7 @@ class HeatConfigNotifyTest(common.RunScriptTest):
requests.post.assert_called_once_with(
'mock://192.0.2.3/foo',
data='{}',
headers={'content-type': None})
headers={'content-type': 'application/json'})
def test_notify_signal_id_invalid_json_data(self):
requests = mock.MagicMock()
@ -170,7 +170,7 @@ class HeatConfigNotifyTest(common.RunScriptTest):
requests.post.assert_called_once_with(
'mock://192.0.2.3/foo',
data='{}',
headers={'content-type': None})
headers={'content-type': 'application/json'})
def test_notify_heat_signal(self):
ksclient = mock.MagicMock()

Loading…
Cancel
Save