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
This commit is contained in:
Juan Antonio Osorio Robles 2016-11-14 16:56:52 +02:00
parent b1714b244d
commit af01bb96ce
2 changed files with 6 additions and 6 deletions

View File

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

View File

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